Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5-4. Batting Average. Write a program that uses parallel arrays to determine the batting average for a baseball team by position. There are nine positions

5-4. Batting Average. Write a program that uses parallel arrays to determine the batting average for a baseball team by position. There are nine positions on a baseball team and your program should have parallel arrays with an upper bound of 9. Your program will read data in pairs; the first number will be between 1 and 9 and will represent the batters position, and the second number will be either 0 or 1 and will represent an out (0) or a hit (1). The program will continue to input data pairs until the sentinel value 1 is read. At that point, the program should output the batting average for each of the nine positions. (Note: Batting average is the number of hits divided by the number of at bats. Therefore, hits and at bats may be good values to store in parallel arrays.) The output shown below was generated using the input file battingaverage.txt, which may be available from your instructor.

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

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

Students also viewed these Databases questions

Question

5. Discuss the key roles for training professionals.

Answered: 1 week ago