Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Only one C++ program not multiple. Follow the instructions carefully please Problem Statement: You are tasked to implement a C++ program that simulates a basketball

Only one C++ program not multiple. Follow the instructions carefully please

image text in transcribedimage text in transcribed

Problem Statement: You are tasked to implement a C++ program that simulates a basketball shooting game for a local high school. The game supports 2 players, with each player attempting to score as many points as possible by making shots from five fixed shooting positions. At each shooting position, there is a rack of five basketballs. Out of the five balls, the first four are regular balls, are worth one point each. The fifth ball, often nicknamed the "money ball", is worth two points. The "money ball" can only be shot after the four regular balls are shot. Of those five positions, the player can choose a position to have a rack consisting only of "money balls", which are all worth two points. This position is called "money-ball rack". The goal of this game is to score as many points as possible. Player 1 needs to finish shooting from all five positions before the next player shoots. The player with the highest score at the end of the game is the winner. After the game is completed, the players will have the option to play again or quit. The program should run until being asked to quit. Implementation Requirements: 1. Before each player shooting, prompt them to choose the "money-ball rack" position. The program should re-prompt until a valid input is given. 1 2. For both players, assuming there is always a 50% chance of successfully making the shot, no matter it is for the regular balls or the money balls. (hint: use rand() function). 3. For each player, you must use an array to keep track of the shooting result for displaying later and calculating the final score. (*Note: it is okay to use multiple arrays to store the shooting result for one player.) 4. The shooting result of each player should be displayed using the following notation: - X for missed shots - O for made shots worth 1 point - M for made shots worth 2 points (the "money ball") 5. For each player, the program needs to display the scores for each rack, and the total score. 6. After both players have completed their shooting, declare the winner (or a tie game). 7. Prompt the players to enter whether they want to play again or quit the game, until a valid input a given. 8. Your program must handle all types of errors and be able to recover from them

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics Of A Networked World Semantics For Grid Databases First International Ifip Conference Icsnw 2004 Paris France June 2004 Revised Selected Papers Lncs 3226

Authors: Mokrane Bouzeghoub ,Carole Goble ,Vipul Kashyap ,Stefano Spaccapietra

2004 Edition

3540236090, 978-3540236092

More Books

Students also viewed these Databases questions