Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Vera takes a jar which contains exactly 100 quarters to the casino with the intention to win big. She plays four machines slot machines

JAVA

Vera takes a jar which contains exactly 100 quarters to the casino with the intention to win big. She plays four machines slot machines in sequence. Unknown to her, the machines are entirely predictable.

Each play costs one quarter.

The following are constants:

The first machine pays 25 quarters every 33th time it is played;

the second machine pays 75 quarters every 99th time it is played;

the third machine pays 7 quarters every 9th time it is played;

the fourth machine pays 1 quarter every 3rd time it is played.

She will always lose - eventually.

Notice that she plays the machines one at a time in sequence: the first one, then the second one, the third one, and the fourth one..the first one, the second one

Your program will output the number of times Vera plays until she goes broke along with the result of each time she wins money. Besides main you must define and use at least 4 methods. The methods can be placed below main or in a separate class.

Your program will input the number of quarters in Veras jar (it could be any number but for this assignment make it 100).

Your program will output a statement EVERYTIME Vera wins money. The output will contain the following:

The Number of Machine (1, 2, 3 or 4) that she just won on

The Amount she just won (formatted like dollars and cents)

The current number of quarters remaining in the jar immediately after the win and the amount of money in the jar (i.e. there are 47 quarters in the jar with equals $11.75.

Once Vera is broke, you will output put the total number of times she was able to play the machine.

Your output will be saved inside of a text file. The text file should be saved in the src folder. You may need to research how to save output to a text file.

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago