Question
C++ programming using visual studio to program do program which calculates and displays a baseball player's batting average and proficiency. There are an unknown number
C++ programming using visual studio to program
do program which calculates and displays a baseball player's batting average and proficiency. There are an unknown number of players.
For any game in which a player participates, his batting average is calculated by dividing his number of hits by his number of at-bats. So if a player had 1 hit in 3 at-bats (we say he was "1 for 3"), his batting average would be .333. If a player was 3 for 4, his batting average for the game would be .750. And if a player played in ten games in which he was 9 for 36, his batting average for the ten games would be .250 (batting averages are always expressed in 3 decimals).
In main, repeatedly have the user enter a player's full name and have the program call the two functions described below, until all players' are processed.
The program will have two functions:
1) this function will receive a player's name into its parameter list; use the name to prompt the user to enter the player's hits and at-bats for each of his games, for any number of games. Each player processed by this function may have played in a different number of games. Validate that for each game, the hits and at-bats are zero or greater, and the hits must not exceed the at-bats (hits and at_bats are data type "int"). Summarize the total hits and at-bats for all games and calculate the batting average for the player, and return it to main.
2) in main the call to this function will pass it a player's batting average; the function will then determine the player's batting proficiency based on the chart below. The function will then return the batting proficiency to main.
Batting Average Range Proficiency
.000 less than 250 Minor Leaguer
.250 less than .300 All Star.
300 less than .400 Hall of Fame
over .400 ---------------- King of Baseball
In main the program will display the player's name, batting average, and proficiency in a user-friendly manner. Display the batting averages to 3 decimal points (don't worry about the leading zero).
Provide 2 screen prints by entering the following data for two players (name; hits & at-bats):
-Will E. Maize; 1 for 3, 2 for 4, 0 for 0, 2 for 3, 1 for 4, 3 for 5
-Jo Dim Magico; 1 for 4, 2 for 3, 3 for 4
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