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
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