Answered You can buy a ready-made answer or pick a professional tutor to order an original one.

QUESTION

C++ Baseball Stat Program

Problem StatementUsing C++ You are to develop a program to read Baseball player statistics from an input file.  Each player should be stored in a Player object.  Therefore, you need to reuse the Player class from program 1.  Each player will have a first name, last name, a position (strings) and a batting average (floating point number).This program adds on to the requirements for Program #1. Please see that assignment.  This will read in the same type of player data from an input file and write the results to an output file.

New RequirementsYou are to reuse your Player class (or my version) from Program1. You are to implement a PlayerList data structure/data type that stores players in a Linked List structure (internal to the class).  Store the players in the list in alphabetical order (By lastname, use firstname to further distinguish in the event there is more than 1 player with the same last name). You will need to add the class PlayerList and the class Node to facilitate the linked list operations.You must implement the following operations on your PlayerList along with any other utility functions you might need.  You may also need to add operations to the class Player to facilitate comparisons since Player data is private.

Operationsï‚· Default Constructor

ï‚· Destructor

ï‚· Add a Player to the List

ï‚· Iterate through the List so that you can get each player

ï‚· Clear out the list to make it empty

ï‚· Test if a list isEmpty 

ï‚· Get the size of the list

ï‚· Find a Player in the List (get) - Put a couple of hard-coded calls in your main program to make

sure this feature works.  

Summary of Operationï‚· Prompt the user for the input and output file names.  DO NOT hardcode file names into your

program.

ï‚· Open input file

ï‚· Read each player and add them to your PlayerList

ï‚· Keep track of the number of players in the list

ï‚· Store the players in the list in alphabetical order (lastname then firstname in the event of two people with the same last name).  You should be adding them in between other nodes as appropriate

ï‚· Test your find operation a couple of times.  This can be hardcoded into your program. You do not have to prompt the user for players, unless you wish to.  Just make sure you test for players that exist and that do not

ï‚· Open an output file

ï‚· Write each player from the list into the output file, along with any other output required by the assignment

Show more
sarahk
sarahk
  • @
  • 10 orders completed
ANSWER

Tutor has posted answer for $35.00. See answer's preview

$35.00

******* *************** PLAYER_H#include<string>class ************** * *********** *********** *********** last_name; std::string position; ****** average;public: Player(); **** ******************** ******* void ******************** ******* **** setPosition(std::string ***** void setAvg(double ***** *********** *********** *********** getLname(); *********** ************** *********** getAvg();};#endif // ***************** ******************************** ***************** ************************************* **************************** ******* ******************* * *********** Player::setLname(std::string lname){ ****************** * *********** ******************************* ***** ***************** * ********* ********************* avg){ **************** * avg;}std::string ******************* ****** ******************************** Player::getLname(){ ****** ******************************* ********************** ****** this->position;}std::string Player::getAvg(){ std::ostringstream sstream; sstream << ***************** ****** sstreamstr();}playerlisth ******************************** PLAYERLIST_H#define ************************************* <list>class ******************* std::list<Player ***** *************** ************* ~PlayerList(); void **************** *p); **** ********************* **** ****************** **** isEmpty(); *** ********** ****** * ************* *************** ** ************************* ************************************ "playerlisth"#include ********************** **** ******** ****** *** ******* p2){ if(p1->getLname()compare(p2->getLname()) **** 0){ return ***** * **** ********************************************** **** *** ****** false; * ***** if(p1->getFname()compare(p2->getFname()) **** *** ****** true; * ***** return false; * *********************************************************** **************************** *p){ ******************** playerssort(compare);}void ********************************* ********************************** *** for (it=playersbegin(); ***************** ****** std::cout<< ******************** **************************** ******** *********************** *************************** ****** PlayerList::clearPlayerList(){}bool ********************** return (playerssize() **** ******* PlayerList::getSize(){ ********************* * ************************* ******* if(index ***** *************** ****** NULL; } int * * ** std::list<Player*>::iterator *** *** ******************* ***************** ++iti++){ if(i ** ******* return **** } ********* **************************** ************************ "playerlisth"#include ******************** ********* ********* ********* std;int ******** **** char *argv[]){ ********** pList; *********** ************** *********** fnamelnamepos; double avg; ****************** ***** **** ****** ****************** cout<<"enter ****** **** ****** cin>>outfile; ****** **** **** ************* **************** std::ofstream ******** ********** ***** ******** ******** fname ******** ***** ******** *** ************ * ****** *p * new ********* p->setFname(fname); ********************** *********************** p->setAvg(avg); ****************** * //Write ** **** ******* * * * * **** ************** * ***** ****** * p * pListgetPlayer(i); *********** **** **************************** outappend(""); outappend(p->getFname()); *************** outappend(p->getPosition()); *************** ************************** *************** ******************************** * finfileclose(); **************** return ***

or Buy custom answer
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question