Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions