I am confused in second part and c++ declaration help!! Archie wants a program t
ID: 3747555 • Letter: I
Question
I am confused in second part and c++ declaration help!!
Archie wants a program that calculates and displays a team's final score in a football game, given the numbers of the team's field goals, touchdowns, one-point conversions, two-point conversions, and safeties. First, create an IPO chart for this problem, and then desk-check the algorithm twice. For the first desk-check, use 3, 2, 2, 0, and 1 as the numbers of field goals, touchdowns, one-point conversions, two-point conversions, and safeties. For the second desk-check, use your own set of data. After desk- checking the algorithm, list the input, processing, and output items in a chart similar.to the one shown in Figure 3-25, and then enter the appropriate C++ declaration statements IPO Chart Input Processing Output Field goals a- field goal3 Display final score Touchdowns - touchdown 6 One-point conversion Two-point conversion Safeties c- one-point conversion *1 d- two-point conversion *2 safeties *2 Final score-at tctdte Desk check 1 input (3,2.2,0,1) Numbers Input Processing Output b 2*6-12 c 2*1- 2 d-0*2 0 10 12 13 Final score- 9+122+0+2-28Explanation / Answer
Since the problem requires simple arithmetic operations on the field goals, touchdown, one-point conversion, two point conversion, safeties and storing each point scored in individual variables a,b,c,d and e respectively and then calculating the sum of all these points into a final score. The followings are the C++ declarations that needs to made in the progam:
Note : Characters following the // symbol are one line comments and won't cause any error in for the below code snippet. They are only included for better understanding and can be omitted in the solution. Underscore ( _ ) has been used for seperating two words in a variable as white spaces and special charaters like '-' is not allowed in C++ declarations
// Code snippet begins
// Since all the points are whole numbers and not fractional or real numbers we can use int datatype
int field_goals; // for storing field goals
int touchdown; // for storing touchdowns
int one_point; // for storing one point conversions
int two_point; // for storing two point conversions
int safeties; // for storing safeties
int a; // for storing the scores from field goals
int b; // for storing the scores from touchdown
int c; // for storing the scoes from one-point conversion
int d; // for scoring the scores from two-point conversion
int e; // for scoring the scores from safeties
int final_score; // for storing the final score
//Code snippet ends
The above declarations can be made in a single line as shown below, but the above keeps the code more readable.
int field_goals, touchdown, one_point, two_point, safeties, a, b, c, d, e, final_score;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.