Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Programming You are to develop a program to read Baseball player statistics from an input file. Each player should bestored in a Player object.

C++ Programming

You are to develop a program to read Baseball player statistics from an input file. Each player should bestored in a Player object. Therefore, you need to define the Player class. Each player will have a firstname, last name, a position (strings) and a batting average (floating point number). Your class needs to provide all the methods needed to read, write, initialize the object. Your data needs to be stored in an array of player objects. The maximum size of the array should be 50for this version of the program. Make sure that you 1) keep track of how many players have beenstored in the array and, 2) you do not overwrite the end of the array if there happens to be more than50 players in the data file. An input data file will be used to provide the data. Each player is written in the file, one per line, in thefollowing form FIRSTNAME LASTNAME POSITION BATTINGAVERAGE Note that the data is separated by blanks only. There are no commas or other separator characters inthe input data. You will need to create your own file for testing.

Make sure to use detailed comments

Summary of Operation Prompt the user for the input and output file names. DO NOT hardcode file names into yourprogram.

Open input file

Read each player and store them in an array of Player objects

Keep track of the number of players in the array

Open an output file

Write each player from the array into the output file, along with any other output required bythe assignment.

Remember to close your files when done with them

Make sure to use detailed comments

Example Input:

Chipper Jones 3B 0.303

Rafael Furcal SS 0.281

Hank Aaron RF 0.305

Example Output:

There were 3 players in the input data file:

Jones, Chipper: 3B (0.303)

Furcal, Rafael: SS (0.281)

Aaron, Hank: RF (0.305

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

ISBN: 0764549634, 9780764549632

More Books

Students also viewed these Databases questions