Question: C + + - I am lost on how to do any of this. 1 st part - Add a static LoadCards method to the

C++- I am lost on how to do any of this.
1st part - Add a static LoadCards method to the WarGame class. Declare your method in the WarGame.h file and define the method in the WarGame.cpp file. It should have a string parameter for the file path. In the method, it should read the cards.csv file and split the data to get each string. Store each card in the _cards vector field of the class. Call the LoadCards method from the WarGame constructor.
2nd part - Add a static ShowCards method to the WarGame class. Declare your method in the WarGame.h file and define the method in the WarGame.cpp file. Loop over the vector and call the Print method on each card. In case 1 of the menu, call the ShowCards method from main (which is in the CardWars.cpp file). Output the cards like the format as shown below:
1. Show Cards
2. Show High Scores
3. Play Card Wars
4. Exit
Choice?
Ex: A// heart symbol
3rd Part
Add a HighScore class with a name field and a score field both with getter/setter methods. Add a constructor that takes a name and score.
4th Part -
Add a Player class with a name field, a score field, a pile field which is a vector of cards, and a won field which is a vector of cards. Add getter/setter methods for the score and name fields.
Add the following methods: HasCards, PushCard, PopCard, and WonCards. HasCards will return true if there are cards in the pile vector. PushCard will take a card parameter
and add it to the pile vector of cards. PopCard will remove a card from the pile vector of cards and return the card. WonCards will take a vector of cards and add it to the won vector of cards and update the score field.
WarGame.h
class WarGame
{
public:
WarGame(std::string cardsFile);
private:
static std::vector _cards;
static void shuffle();
};
WarGame.cpp
std::vector WarGame::_cards;
WarGame::WarGame(std::string cardsFile){}

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!