Answered step by step
Verified Expert Solution
Link Copied!

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.
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

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions

Question

EXPLAIN the importance of application forms.

Answered: 1 week ago