Write a program to process bowling scores for players on a team. Calculate each player's series (the sum of his bowling games) and his average game score. Sum the players' scores for each game, and calculate the team's total for each game, the team's series, and the team's average game score. For each player and each team, print the scores for each game, series, and average. Write the program so it can handle as many teams as the user wants to process or no teams at all. Allow the user to continue entering team scores until he indicates there are no more teams to process. If one or more teams' scores are entered, print the team number with the highest series and its series score at the end of the program. Name your source code file LetsGoBowling.cpp.
1.
Print an overview of the program's purpose. This should be in terms a user would understand. In the purpose, tell the user how many players are on each team and how many bowling scores there are per player. Make sure the purpose is printed only once per program execution.
2.
Ask the user if he/she wants to continue. He/she must be able to quit without having to enter a single team's score. As long as the user wants to continue entering data, prompt him/her for team's scores. There is no constant number of teams. The user must tell the program when he/she wants to quit.
3.
Process one team at a time. Prompt the user for the first team's scores by first asking for player one's score for game one, then game two, and then game three. Edit each bowling score, and do not continue the program until a valid value is entered. A bowling score can be between 0 and 300, inclusive. If an invalid score is entered, print an error message with the invalid score and request a valid score be entered. After player's one scores are correctly entered, calculate the series total by adding his/her games' scores. Calculate the player's game average (2 decimal precision) by dividing series by number of games. Then print that player's individual games' scores, his series, and his game average. Although three is generally recognized as the number of games in a bowling series, use a symbolic constant for number of games. For this program, assign the number three to the symbolic constant for number of games in a series. Code the program in a way that if the number of games ever changed in series, the only change to your program would be a change to the value of the symbolic constant.
4.
After the first player's processing is complete, start processing the other players' scores on the team. For this program's purpose, use a symbolic constant for the number of players on a team and assign it a value of four. Again, if number of players per team ever changes, the only change to your program should be the value of your symbolic constant.
5.
After all player's scores have been processed and printed, print the team totals for each game and series. Calculate the team's game average (2 decimal precision) by dividing the series total by the number of games in a series. Print team's game average.
6.
Ask the user if he wants to enter more data. Process each team as previously described if he/she does want to enter more data.
7.
When the user decides he/she doesn't want to continue, print the team number with the highest series and its series. For the purposes of this program, do not worry about teams tying for highest series. If two teams did have the same series, the honor of high series would remain with the first of the teams processed by the program. If the user quit the program before entering any teams, do not print any information on high series.
8.
Print a closing message to the user.
9.
Use an array to store the bowling scores. You may need more than one array. You do not need to use a two dimensional array but you can if you want. You must have at least 1 function that accepts an array as an argument and updates the array in the function. You may have more than one function that accepts an array as an argument. Do not use any global variables. Symbolic constants may be used and these may be global.
My code so far is:
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <stdlib.h>
using namespace std;
void printintromessage ();
void getUserInput (char& Y);
void printplayerinfo (const int& numofgamesinseries, const int& numofplayersonteam, int& i, double& scoresinput);
int main(int argc, char *argv[])
{
const int numofgamesinseries = 3;
int i, score[numofgamesinseries];
const int numofplayersonteam = 4;
int p, player[numofplayersonteam];
double inputscores[numofgamesinseries] = {};
char Y = Y;
double scoresinput;
printintromessage ();
getUserInput (Y);
do
{
if (Y == 'Y' || Y == 'y')
{
printplayerinfo (numofgamesinseries, numofplayersonteam, i, scoresinput);
}
else
{
cout << "All finished ? Thank you !" << endl;
}
}
while ((Y == 'Y' || Y == 'y'));
system("PAUSE");
return EXIT_SUCCESS;
}
void printintromessage ()
{
cout << "This program processes bowling scores." << endl;
cout << "The user is asked to enter 3 bowling scores" << endl;
cout << "for each person on the team. There are 4 people" << endl;
cout << "per team. After all the scores are entered" << endl;
cout << "for a player, the program will list the individual" << endl;
cout << "game scores,the player's total score (series), and" << endl;
cout << "the player's average.After each team's input is complete," << endl;
cout << "the program will list the team's total scores by game," << endl;
cout << "the team's total score (series)and the team's average." << endl;
cout << "The user will then be asked if he/she wants to" << endl;
cout << "enter more data. If not, the program will list the" << endl;
cout << "team with the highest total score (series) and that " << endl;
cout << "total. If the user wants to enter more data," << endl;
cout << "the above process is repeated." << endl;
cout << " " << endl;
}
void getUserInput (char& Y)
{
cout << "Do you want to enter (more) data?" << endl;
cout << "Enter Y to continue, anything else to quit: ";
cin >> Y;
cout << " " << endl;
}
void printplayerinfo (const int& numofgamesinseries, const int& numofplayersonteam, int& i, double& scoresinput )
{
for (i = 1; i <= numofgamesinseries; i++)
{
cout << "Enter player " << 1 << "'s score " << i << ": ";
cin >> scoresinput;
if (scoresinput > 0 && scoresinput <= 300)
cout << "good" << endl;
else
cout << scoresinput << " is not a valid score ! Score must be from 0 to 300" << endl;
}
}
It's not complete and I know i'm not close, but the problems I am facing are causing me to not be able to move on;
My issues are:
1. How do I store the scores in arrays, then recall them?
2. How do I prompt the user for 3 scores from 4 players before it prints the scores?
3. I have the counter down for player's score, but how do I set one for the player, such as player 1 score - 3, then go to player 2 score 1 - 3?
What I am trying to do is input all the data into the array or if need me multiple arrays and then have them print and I am having lots of issues please help!!!