CS110: Fundamentals of Computer Programming Assignment 2

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (3 votes)

Introduction
In this assignment you have to understand and implement the following concepts
• Loops
• Nested Loops
Objectives
• To develop skills for using loops.
• To understand how to program conditional calculations.
Tools/Software Requirement
• Microsoft Visual Studio 2010 or later
Task 1 [6]
Write a program that allows a human user to play a simplified version of Blackjack against a
computer opponent (you need to learn and use random function).
The simplified blackjack rules are as follows:
• Don’t worry about suits or face cards; “cards” will have values from 2-11, and all values are
equally likely (that is, unlike a real blackjack game, there’s no greater chance of drawing a card
with value 10).
• Draw two cards for the player and display them.
• Draw two cards for the “dealer” and display one of them, keeping the other one hidden.
• Allow the player to “hit” as many times as he would like.
• If the player “busts” (gets a total over 21), the dealer automatically wins.
• Allow the dealer to hit as many times as he would like. Dealer should probably hit on sixteen or
lower.
• If the dealer busts, the player automatically wins.
Assuming no one has busted, the player with the highest total wins. Dealer wins all ties.
CS110: Fundamentals of Computer Programming Page 3
Sample output:
Courtesy: G. Mitchell
Task 2 [4]
Print the table of multiples for numbers up to 16 using loops. The output will be similar to the
following table and you must use for loops:
1 2 3 4 5 6 7 8 … 16
1 1×1=1 1×2=2 1×3=3 … … … … … …
2 1×2=2 2×2=4 … … … … … … …
3 … … … … … … … … …
4 … … … … … … … … …
… 16 … … … … … … … … …
CS110: Fundamentals of Computer Programming Page 4
General Instructions
Any assumptions that you take must be properly stated.
You must do this work individually but you can ask for help from the Lab Engineer. You cannot
share your code with anyone or copy code. Plagiarism will result in zero marks.
Deliverables
Submit only 1 zip file (please do not submit a .rar as it does not decrypt through script) on the
given LMS link, which contains both the programs. You must include the source code files (the
.c or .cpp files), not an exe or any other kind of file. Anyone who submits a word document or
anything other than source files will be awarded a zero. Your file should be named as
asg1[YOUR FIRST AND LAST NAME].zip
Always submit 1 day before the deadline to avoid any last minute delays.
Marks break down:
1. Working of the program: 60%
2. Code readability: 20%
3. Output structure and aesthetics: 20%