Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
st 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.
nd 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 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:
Show Cards
Show High Scores
Play Card Wars
Exit
Choice?
Ex: A heart symbol
rd Part
Add a HighScore class with a name field and a score field both with gettersetter methods. Add a constructor that takes a name and score.
th 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 gettersetter 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:
WarGamestd::string cardsFile;
private:
static std::vector cards;
static void shuffle;
;
WarGame.cpp
std::vector WarGame::cards;
WarGame::WarGamestd::string cardsFile
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started