Question: Use UML to develop class models. Identify objects and classes in a C++ program. Model an object-oriented C++ solution. Understanding how to take C++ classes

  • Use UML to develop class models.
  • Identify objects and classes in a C++ program.
  • Model an object-oriented C++ solution.

Understanding how to take C++ classes and create a class UML based on the access modifiers and methods is essential.

Begin this assignment by identifying a set of objects from the"Slot Code." If you have difficulty with this step, try describing the gameand then making a list of the nouns and verbs in your description. The nouns will represent the objects, or classes, and the verbs represent the actions, or methods, on those objects. Once you are satisfied with your set of identified objects, begin constructing the UML diagrams. Next, create a flowchart that models the game logic.The flowchart should incorporate the methods identified in your description.

Slot.txt:

class Slot{

private:

Reels reel[3];

Bets bet;

Arm bar;

int payout;

int jackpot[3];

int pullLeaver(){

return bet.placeBet();

}

void checkWin(){

if(jackpot[0] == jackpot[0]){

cout << "Winner you now have " << payout + 40 ;

}

else{

cout << " Loser sorry your bank is " << payout;

}

}

public:

Slot(Reels s, Bets b){

bet = b;

for(int i = 0; i < 3; i++){

reel[i] = s;

}

}

void display(){

for(int i = 0; i < 3; i++){

jackpot[i] = reel[i].spin();

}

}

void showing(){

payout = pullLeaver();

for(int i = 0; i < 3; i++){

display();

reel[i].show();

}

cout << endl;

checkWin();

}

};

Reels.txt:

#include

using namespace std;

class Reels{

private:

int value;

public:

Reels(){

value = 0;

}int spin(){

value = rand() % 20 + 1;

return value;

}

void show(){

cout << value << " ";

}

};

Main.txt:

using namespace std;

int main() {

srand(time(NULL));

Reels x;

Bets b;

Slot test(x, b);

test.showing();

}

Bets.txt:

#include

using namespace std;

class Bets{

private:

int chips;

int bet;

public:

Bets(){

chips = 100;

bet = 0;

}int placeBet(){

cout << "How much would like to wager?" << endl;

cin >> bet;

if(bet > chips){

cout << "You only have " << chips << " left ";

bet = 0;

placeBet();

}

return chips = chips - bet;

}

};

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 Programming Questions!