Create a Console Game System ADT using C++ classes: Game, Console, PS4Pro, and Switch.

  • Visual Studio 2017 Community Edition Solution/Project
    • Visual C++ -> Empty Project
    • Solution/Project naming convention: < Last name>6
  • The following class diagrams show the required attributes and custom methods
  • The standard methods are assumed to exist
    • setters and getters are required for the Game class only - explicit inlining
  • Each class manages its own data - with the following exceptions:
    • PS4Pro and Switch constructors populate the inventory (games) after Console has created it

Class Diagram: see image.

processStart

Manages the overall flow used by the selected console game system.

  • Purchasing process algorithm:
    • processIntroduction
    • processSelection
    • processPayment
    • processChange
    • processDelivery
  • Repeated until the system is shutdown at the main console system selection menu.

process Introduction - pure virtual

Displays a friendly message introducing the customer to the selected console game system store.

processSelection

Displays and uses a neat and easy to understand menu system that allows the customer to select one console game from the selected console game system (display 1 console game per line).

  • A console game can only be selected if it is currently in stock.
  • Decrement the appropriate console game inventory quantity with each successful purchase.

processPayment - virtual

Console accepts $20, $10 // $29 dollars might be entered as
PS4Pro accepts $10, $5, $1 // (2) $10, (1) $5, (4) $1
Switch uses Console processPayment // (0) $20, (3) $10

Prompt the customer for the quantity of each payment value one payment value at a time.

  • Always prompt for all payment values.

processChange - virtual

Console returns $10, $1 // $17 dollars would be changed as
PS4Pro uses Console processChange // (1) $10, (7) $1
Switch returns $5, $2, $1 // (3) $5, (1) $2, (0) $1

Display the quantity for each change value one change value per line.

  • Change is calculated by returning the largest quantity of the largest change value and then repeating this for each smaller change value in order.
  • Always calculate and display all change values - even if 0.
  • Hint: use integer/remainder division

processDelivery

Display a friendly message telling the customer their successfully purchased console game is being delivered.

  • Only allow console games to be delivered to customers after proper payment has been made.
  • Thank the customer for using the console game system store.

Driver program

Displays and uses a neat and easy to understand menu system that allows the customer to select a console game system: PS4Pro or Switch (display 1 console game system per line).

  • The customer must be allowed to choose any or all of the console game systems as many times as they would like before exiting the program.
    • Only one console game system selected at a time.

The console game systems have the following available inventory:

PS4Pro Switch
Call of Duty WWII $54 3 Legend of Zelda $46 3
Far Cry 5 $50 4 Skyrim $50 5
God of War $46 5 Super Mario Odyssey $57 1
Red Dead Redemption 2 $57 2

All members are "instance" members of classes: Game, Console, PS4Pro, and Switch.

The only public members of classes Game, Console, PS4Pro, and Switch are:

  • Constructors and destructors, setters and getters, and processStart

Used to define a single console game instance.

class Game { // Game.h & Game.cpp
friend std::ostream& operator<<(ostream &, const Game &);
public:
Game(const char * = "", const int = 0, const int = 0); // name, price, quantity
~Game();
Game(const Game &);
Game & operator=(const Game &);
string getTitle() const;
int getCost() const;
int getQuantity() const;
void setTitle(const char * = "");
void setCost(const int = 0);
void setQuantity(const int = 0);
private:
std::string title; // game title - C++ string reference
int cost; // game cost in dollars
int quantity; // game quantity
};

Used to define the basic functionality required by a console game system manufacturer.

class Console { // Console.h & Console.cpp
public:
Console(const int = 0); // number of different games - PS4Pro (4) - Switch (3)
~Console(); // provided by PS4Pro and Switch derived classes
void processStart();
protected:
Console(const Console &); // cannot use to instantiate
virtual void process Introduction() = 0; // pure virtual function - MUST be overridden
void processSelection();
virtual void processPayment(); // as needed adjust the arguments and return types
virtual void processChange(); // of the processXXXXXX functions
void process Delivery() const;
const int GAME_OPTIONS; // number of different available games
Game * games; // dynamic array of Game instances - GAME OPTIONS
int selectedGame; // game currently selected
int amountPaid; // customer payment in dollars

class PS4Pro // PS4Pro.h & PS4Pro.cpp
class Switch // Switch.h & Switch.cpp
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.