Homework Assignment #3

 

CS 161: Introduction to Computer Science 1

 

 

Submit solutions to D2L’s Homework #3 Dropbox

 

New Due Date: On Time: February 3rd or

Late: February 6th

 

***Homework in CS161 consists of written homework and programming***

 

1.      Create an Algorithm, in English, to explain how a two player game works

·        Select a game of your own choice – but make sure it is a relatively straight forward game, such as   hangman, jacks, pool, go-fish. (You can’t pick black jack or tic tac toe, as those are lecture examples).

·        Think about how you select who goes first, how do you alternate from player to player and how do you keep track of scores.

 

2.      Think about Style We are getting a better handle on what style is all about: comments, indentation, descriptive variable names, good spacing, etc. We are going to create our own set of style requirements this term. List 3 things that you want to be graded on for style in your programs. We will use these to compile a “style sheet” that our grader can use in the future!

·        Remember, style is all about how readable and/or maintainable a program is.

 

1.      Ethics. There are many aspects of computer ethics – meaningful messages and clear instructions are important from a users perspective. Now let’s talk about the programmer’s responsibility to accurately calculate the results. Give examples where an incorrect or inaccurate calculation could result in devastating circumstances.

 

2.      Programming. Pick one of the following programs to create for Homework #2. Only do one of them:

1.      Write a C++ program that takes the avatar (from homework #2) and gives the user the ability to change the color and location on the screen. This will require using variables, input and output statements with the console like we have been doing in class.

2.      The program must have at least one if statement and one loop. You can use the loop to do a “confirmation loop” for the information the user typed in (for color) for example.

 

Write a C++ program that takes your program from Homework #2 (Part 4) and adds the following features:

1.      If the user enters in a value less than 0 or greater than 100, the program should display an error message and let the user re-enter the homework grade.

2.      After the final average grade is calculated, the program should allow the user to start again, with another set of 5 homework scores. Let this process continue until the user wants to quit.