Question: Write a program named intavg.cpp that implements the list using a vector: In a loop. ask the user for integers If the user enters -

 Write a program named intavg.cpp that implements the list using a
vector: In a loop. ask the user for integers If the user

Write a program named intavg.cpp that implements the list using a vector: In a loop. ask the user for integers If the user enters - 1. end user input o Use an input validation loop to make sure the user input is 2 or greater Append the validated integer to the vector o Use the push_back() vector member function Calculate and display the resulting arithmetic mean (average) of the vector WITH the new integer o Use the size () member function If the mean is NOT a whole number: o Display a message rejecting the integer and remove the integer from the vector - Use the pop back() member function If the mean is a whole number: Display a message accepting the integer and keep the integer in the vector Once the user is done (user enters -1), calculate and display the mean of the first one element, first tw clements, and so on, until the mean of the entire vector is calculated and displayed Each mean should be a whole number Task 1 Sample Output Please enter an integer (2 or greater, -1 to finish): 14 That is not a valid number! Please try again. Please enter an integer (2 or greater -1 to finish): 24 The new arithmetic mean is 2 Your input has been accepted! Please enter an integer (2 or greater, -1 to finish): 3. The new arithmetic mean is 2.5 Sorry, your input was rejected and will be removed! Please enter an integer 12 or greater, -1 to finish): 4 The new arithmetic mean is 3 Your input has been accepted! Please enter an integer (2 or greater -1 to finish) : 62 The new arithmetic mean is 4 Your input has been accepted! Please enter an integer (2 or greater, 1 to finish): 72 The new arithmetic mean is 4.75 Sorry, your input was rejected and will be removed! Please enter an integer (2 or greater, -1 to finish): 8. The new arithmetic mean is 5 Your input has been accepted! Please enter an integer (2 or greater, -1 to finish): -1. Vector Elements: numbers to) - 2 numbers 1 4 numbers1216 numbers [3) Mean of the first element(s): 2 Mean of the first 2 element(s): 3 Mean of the first 3 element(s): 4 Mean of the first 4 element(s): 5 Task 2 A game of basketball is divided into four quarters. If the score is tied at the end of the fourth quarter, then additional quarters will be played, as many times as necessary, until the tie is broken. The score for each quarter and each time is compiled into a table called a box score, which looks like the following: 10_(Ist quarter) 20 30 40 T otal AWAY (team 1) 23 19 3 3 18 93 HOME (team 2) 2227271389 Write a program named bball.cpp that builds a box score for a basketball game: Maintain two parallel vectors of scores, one for the away team and another for the home team Ask the user for integer scores of a basketball game for each team in the first four quarters Use an input validation loop to make sure the user input is 0 or greater If the score is tied at the end of the 4th quarter, increase the size of both vectors by 1 and get scores for the additional quarter (repeat as many times as necessary until the tie is broken) When the game is over, print a well-formatted box score table of the game, including the total score for cach team Task 2 Sample Output 10 away team score: Please enter a number (0 or greater): -5 That is not a valid number! Please try again. Please enter a number (0 or greater): 28- 10 home team score: Please enter a number (0 or greater): 23- 20 away team score: Please enter a number (0 or greater): 27- 20 home team score: Please enter a number (0 or greater): 24 30 away team score: Please enter a number (0 or greater): 26- 30 home team score: Please enter a number (0 or greater): 30- 40 away team score: Please enter a number (0 or greater): 13- 40 home team score: Please enter a number (0 or greater): 17 It's a tie! Let's play another quarter. 50 away team score: Please enter a number (0 or greater): 8- 50 home team score: Please enter a number (0 or greater): 8. It's a tie! Let's play another quarter. 60 away team score: Please enter a number (0 or greater): 90 60 home team score: Please enter a number (0 or greater): 8. 10 20 30 40 50 60 TOTAL AWAY 28 27 26 13 8 9 111 HOME 23 24 30 17 8 8 110

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!