Question: Write a complete C++ program including comments to do the following: Outline: The program will compute football statistics. The program will read in the id

Write a complete C++ program including comments to do the following: Outline: The program will compute football statistics. The program will read in the id number and the win-loss-tie record of a football team. It will compute various things about the team, and it will print everything out. Then it will repeat the process for a new team, over and over again, until the entire set of data has been taken care of. At the end, it will print the number of teams. Here are the details: 1. The program will read in the id number of a team (see step 6 below). The program will read in the number of wins this team has, the number of losses, and the number of ties. For example, the program could read in the following four pieces of data--and the program will print everything read in: 1234 7 5 2 [ this says team 1234 has 7 wins, 5 losses, and 2 ties ] 2. The program will compute (and print) the total number of games played, which is simply the number of wins plus the number of losses plus the number of ties. The program will also print the number of games remaining in the season, which is 16 minus the total number of games played. If the total number of games played is exactly 16, the program will print a message saying the teams season is finished. If the total is less than 16, the program will print how many games are still remaining in the season. You can assume that no team has played more than 16 games (see optional 3 below). For example, for the team shown above, the total number of games played is 14 (why?), and there are 2 games still remaining (16 14 = 2). 3. The program will compute the team's winning average, which is a decimal value between 0 and 1. The winning average is defined to be the number of games won divided by the total number of games played. For the team shown above, the winning average is 7 divided by 14 = 0.5000. The program should print this out as shown here, with exactly 4 decimal places. 4. The program will compare the number of games tied to both the number of games won and the number of games lost, printing two separate messages--one for each comparison. Each question below must always have a single message printed for it. First, the program will determine whether or not the number of games tied is greater than or equal to the number won. Print an appropriate message in either case. Then the program will determine whether or not the number of games tied is greater than the number lost. Print an appropriate message in either case. Note that these two questions are not the same. And note carefully the phrasing of the two questionsif possible, use my phrasing. You must test all of the four possible combinations of yes/no answers to these questions see below. 5. Compute the wip total. This is the number of wins plus the number ties minus three times the number of losses. However, the value cannot be negative. If it would evaluate to a negative value, the program should display it as 0. (Test this at least 2 times.) 6. Then the program should skip a few lines of output and repeat the entire series of steps for the next team, and so on, until the last team has been processed. You must decide how to recognize that the last team has been processed. There should be a comment in the program explaining how you know that the last team has been processed. 7. At that point, print the total number of teams that have been processed, then stop. DATA: Read in data for at least 8-10 teams. Make sure that at least three teams have completed their season, and at least five have not. Have a team with the number of wins equal to the number of ties, and have a team with the number of losses equal to the number of ties. Have a team with all wins, have a team with all losses, and have a team with all ties. Make sure that every possible path through the program is covered by a set of data. Here is a complete set of output for a typical team: team 9867 4 wins 2 losses 3 ties total number of games played is 9 7 games still remaining the winning average is 0.4444 number of games tied is not greater than or equal to number won number of games tied is greater than number lost the wip total is 0 OPTIONALS: 1. For each team that has not completed the season, compute the team's record if the team wins all of the remaining games (give the won-lost-tie record and the winning average), and the record if the team loses all of the remaining games. 2. Keep track of the team with the best winning average that is not exactly 1. Print this out at the end. Do the same just for those teams that have completed their season. 3. If a team has completed more than 16 games, print an error message, ask the user to type in new data (repeat if necessary). Do NOT process the original set of data.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!