Question: C + + ONLY PLEASE First, you will need to have an Player . h file, which contains the Player class interface that can hold

C++ ONLY PLEASE
First, you will need to have an Player.h file, which contains the Player class interface that
can hold information about players on a team. Include an include guard as discussed in the text.
The class should have the following private member variables:
Member Variable
Name
and Description
playerNumber An int that holds an playerss ID number. This number cannot
be less than 0 or more than 99. Input validation must be done by
the driver program
playerName A string that holds a players name, the name may contain a
space. such as: John Doe. No input validation needed.
playerAge An integer that contains the players age at the start of a baseball
season. The range of values is 4 through 16 inclusive. Input
validation must be done by the driver program.
batAverage A double that holds the batAverage of an player, the batAverage
should be positive (including 0) decimal number less than or
equal to 1.000. Input validation must be done by driver program.
The class should have the following public member functions. You may not create more member
functions than the six listed below:
Member Function
Name
Description
Constructor This constructor will:
setplayerNumber to be 0,
playerName to be *none*,
playerAge to be 0,
batAverage to be 0
Overloaded
constructor
This constructor should have four input parameters, integer for
playerNumber, a string for playerName, an integer for players age, and a
double for batAverage. Each parameter should be assigned to the
corresponding member variables
Destructor The destructorshould display a message in the following format:
[playerNumber],[playerName] removed (example,6, John Doe removed)
setPlayerNumber Accepts an int argument and copies it into the playerNumber member
variable
setPlayerName Accepts a string argument and copies it into the playerName member
variable
setPlayerAge Accepts an integer argument and copies it into the playerAge member
variable
setBatAverage Accepts a double argument and copies it into the batAverage member
variable
getPlayerName Returns the value in playerName
getPlayerNumber Returns the value in playerNumber
getPlayerAge Returns the value in playerAge
getBatAverage Returns the value in batAverage
Class declarations should be in Player.h, and member function definitions should be in
Player.cpp. Do not define any inline functions. The driver program should be in a file name
PlayerDriver.cpp. All three programs must be submitted separately to the Canvas assignment.
(Do not submit a zip file)
Driver program (PlayerDriver.cpp) should have the following functions. And should also
dynamically allocate a Player array of the number of players entered by the user.
Player * ptrPlayer = new Player[size]; //size is entered by the user
void displayAllPlayerRecord(const Player *
ptrEmp, const int size)
Display in the following format described
below
void getInput(Player * ptrEmp, const int size) Ask user to enter all values for all Player
objects, input must be validated. Use
cin.ignore in appropriate places.
You probably also need the following functions in your driver program (not part of the
requirement), getInput function above should call these functions:
int getID() Validate the input of an ID, ID cannot be less than 0 or more than
99
int getAge() Validate the age is greater than or equal to 4 and less than or equal
to 16
double getBatAverage() Validate the input of a batAverage, make sure the batAverage is
greater than or equal to zero and less than 1.000
Other Requirements:
1. One function should only handle one task. Feel free to add more functions to the driver
program if needed. But no function should be more than half a page. You may not
add/change member functions.
2. Use string line(60,*) for line in the sample output
3. The main function should be less than half a page with return 0 included.
1. Main function should only call other functions and display messages.
4. Your output should be similar to the provided output (attached below), including format
and messages.
5. Submit your three programs to the Canvas assignment before the due date and time.
1. Each program should have a heading (name, course number etc. )
2. In the headings of each program, you should list other files included.
3. For example, in Player.h, you should say other files included: Player.cpp,
PlayerDriver.cpp
4. Use #ifndef.. etc. on top of your Player.h
Sample Output (notice the line separator presented here has 60*)
Enter the number of players(must be greater than zero): -1
The number of players must be greater than 0- re-enter: -2
The number of players must be greater than 0- re-enter: 3
Enter player 1s number: 12
Enter player 1s name: John Hunter
Enter player 1s age: 18
The player's age must be a between 4 and 16 inclusive
Re-enter player 1s age: 15
Enter player 1s batting average: .310
Enter player 2s number: -1
The player's number must be a positive number less than 99
Re-enter player 2s number: 14
Enter player 2s name: Mike Austin

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!