Menu

[Solved]Write Java Assignment Simulates Behavior Casino Three Slot Machines Motivation Practice Ob Q37255698

Write a Java assignment that simulates the behavior of a Casinowith three slot machines.

Motivation: Practice with the Object-Oriented concepts ofinheritance and overriding.

Here are the rules for each machine

Machine A:

Cost of a game: 1 token

Number of reels: 4

Each reel can display a SUN or a MOON

The machine pays off 2 tokens if one and only one reel displaysa sun

The machine pays off 100 tokens if ALL the reels display asun

Machine B:

Cost of a game: 1 token

Number of reels: 3

Each reel can display an ORANGE, or a CHERRY, or a WATERMELON ora QUESTION MARK.

The machine pays off 500 dollars if ALL the reels display thesame image: 3 oranges, 3 cherries, 3 watermelons, or 3 questionmarks.

The machine pays off 10 tokens if one and only one real displaysa Question Mark.

The machine pays off 100 tokens if the reels display 1 Orange, 1Cherry and 1 Watermelon.

Machine C

Cost of a game: 1 token

Number of reels: 4

Each reel can display the 10 numbers in the range: [0 .. 9]

The machine pays off 10 tokens if the reels display TWOidentical digits ( Example 7078)

The machine pays off 100 tokens if the reels display THREEidentical digits ( Example 4644)

The machine pays off 1000 tokens if the reels display THREEidentical digits ( Example 5555)

Write a Java program that simulates the use of the slot-machinesby a player.

Your program should define a class named SlotMachine, and threeclasses inherited class: SMA, SMB, and SMC, each overriding themethod(s) of the super-class.

The player enters the Casino with 50 tokens.

Every time the player selects a machine (A, B or C)randomly.

The visit to the Casino ends when either the player’s reserve is0 or at least 1000 tokens.

For each win, (not for a loss) display on one line:

– The sequence number of the attempt

– The machine type (A, B or C) that is paying

– The amount paid

– The configuration displayed

– The current amount of the player

Expert Answer


Answer to Write a Java assignment that simulates the behavior of a Casino with three slot machines. Motivation: Practice with the… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *