Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program, that simulates a betting game. It first asks the user for the original amount, A. As long as the user still

 

Write a program, that simulates a betting game. It first asks the user for the original amount, A. As long as the user still has money (that is A is greater than 0), the program asks them to bet. The user indicates the amount of the bet and if it is a win or a loss by entering a positive or a negative value: - a positive value is a win and TWICE that much is added to A, - a negative amount is a loss and is subtracted from A. Sample run 1 Enter A: 100 Enter bet: 20 Now A is : 140 Enter bet: -50 Now A is : 90 Enter bet: 10 Now A is: 110 Enter bet: -130 Now A is : -20 Sample run 2 Enter A: 30 Enter bet: -10 Now A is : 20 Enter bet: -15 Now A is : 5 Enter bet: -5 Now A is : 0 Activate Windows

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres an example program in Java that simulates the described betting game java import javautilScann... 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_2

Step: 3

blur-text-image_3

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

Matlab An Introduction with Applications

Authors: Amos Gilat

5th edition

1118629868, 978-1118801802, 1118801806, 978-1118629864

More Books

Students also viewed these Programming questions