Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COMSC 165

Fall 2022

Programming Assignment 1

(COMSC 110 Review)

COMMENTS  worth 1.25 points (10%) of your programming assignment grade:

Your program should have at least ten (10) different detailed comments             explaining the different parts of your program. Each individual comment should be, at a minimum, a sentence explaining a particular part of your code. You        should make each comment as detailed as necessary to fully explain your code. You should also number each of your comments (i.e., comment 1, comment 2,  etc.).

Sample Runs  worth 1.25 points (10%) of your programming assignment grade:

You should submit screenshots of at least five (5) different sample runs of your   program. Each sample run needs to use different inputs, and your sample runs    should NOT be the same as the sample runs that are used in this write-up for the assignment. You should also number each of your sample runs (i.e., sample run   1, sample run 2, etc.). Each of your sample runs should be similar to this format:

 

Write a C++program that follows the following steps:

INPUT

1.  Prompt the user for the name of the first runner (type string variable)

2.  Prompt the user for runner 1’s finishing time (type double variable)

3.  Prompt the user for the name of the second runner (type string variable)

4.  Prompt the user for runner 2’s finishing time (type double variable)

5.  Prompt the user for the name of the third runner (type string variable)

6.  Prompt the user for runner 3’s finishing time (type double variable)

 

PROCESS

7.  First, check if any of the times entered for any of the runners is less than zero. If this is the case, an error message should be displayed and then   the program should end (see below).

8.  If none of the times are negative, then do the following:

8A. Determine which runner made first place. (store this information in a variable of type string)

8B. Determine which runner made second place (store this information in a variable of type string)

8C. Determine which runner made third (last) place (store this information in a variable of type string)

 

OUTPUT

9.   If any of the times entered for any of the runners are negative, then display the error message.

10. Otherwise display the following

10A. Display which runner made first place

10B. Display which runner made second place

10C. Display which runner made third (last) place

OPTIONAL: If you would like you could also include an input validation loop into    your program – if the user enters invalid data for any of the runner’s times, the      loop will keep asking the user to reenter the time until they enter something valid. This will normally be a requirement for any programming assignment that asks the user for input, but for this first programming assignment it is optional. You may      also include functions in your program if you would like – we will be covering          functions in chapter 6.

Sample Runs:

The sample runs below will show you how your program should run for various   inputs. The idea is that if you run your program with my inputs shown below, the output of your program should be the same as my output. This is how you can     test your program to confirm that it is correct, but you are also encouraged to     come up with your own additional test cases to further test your program.

Sample Run 1:

 

Sample Run 2:

 

Sample Run 3: