Question: Develop a C++ program that will input singles, doubles, triples, and home runs and then calculate the total hits and total bases. Use separate procedures

Develop a C++ program that will input singles, doubles, triples, and home runs and then calculate the total hits and total bases. Use separate procedures with local variables for the program.

The program will prompt and input each of the types of hits. Use main for the input and output and two separate user defined functions or methods, where each of the types of hits is sent to the function as arguments. The first function will determine the total number of hits, save into a local variable, and return it. The second function will determine the total number of bases in a local variable and return it. The number of bases would be one for every single, two for every double, three for every triple, and four for every home run. Each of these values will be labeled and printed in main.

Run your program with the following players in two runs:

Input

Singles: 158 Doubles: 39 Triples: 3 Home Runs: 14

Output

Total Hits: Total Bases:

Input

Singles: 104 Doubles: 26 Triples: 1 Home Runs: 35

Output

Total Hits: Total Bases:

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!