Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 cach time is compiled into a table called a box score, which looks like the following: 10 st quarter 20 30 40 Total AWAY team !) 23 19 IS193 HOME (team 2) 22 27 13 89 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 o 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 I 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 each team Task 2 Sample Output 10 away team score: Please enter a number (0 or greater): -54 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): 234 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 ( Oor 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): 174 It's a tie! Let's play another quarter. 50 away team score: Please enter a number (O DE 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): 9. 60 home team score: Please enter a number (0 or greater): 8. 10 20 30 40 50 60 TOTAL ANAY 29 22 26 13 3 9 111 HOME 23 24 30 17 3 8 110
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started