Write a program, that simulates a betting game. It first asks the user for the original...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
Heres an example program in Java that simulates the described betting game java import javautilScann... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Examine the following program: class Exercise1 { public static void main (String[] args ) { int[] val = {0, 1, 2, 3}; sum = System.out.println( "Sum of all numbers = " + sum ); } } Complete the...
-
4. An ice hockey puck travels with a speed of 15 m/s straight towards the extended goal line when it receives a quick blow from a hockey stick. The puck weighs 160 g and receives an impulse from the...
-
Consider the following excerpts from a Wall Street Journal article on Burger King (Beatty, 1996): Burger King intends to bring smiles to the faces of millions of parents and children this holiday...
-
Consider how economic conditions affect the default risk premium. Do you think the default risk premium will likely increase or decrease during this semester? How do you think the yield curve will...
-
From the following Latimer diagram (which does not correspond to standard conditions), calculate the value of E for the reaction 2HO 2 (aq) O 2 (g) + H 2 O 2 (aq). Comment on the thermodynamic...
-
Ed Proctor, EDP auditor, approached Manfred Davis, manager of data processing, and said, "I noted that your programmers sometimes operate computer equipment. " "So what?" asked Davis. "That's...
-
Congress regulates corporate fuel economy and sets an annual gas mileage for cars. A company with a large fleet of cars hopes to meet the 2011 goal of 30.2 mpg or better for their fleet of cars. To...
-
Find the length of the following parametric curve. x = 3 + 6 t 4 , y = 1 + 4 t 6 , 0 < = t < = 2 .
-
Preparing Closing Journal Entries The following selected accounts appear in The GAP Inc.'s financial statements for the fiscal year ended February 2, 2019. $ millions Debit Sales Credit $16,580 Cost...
-
The graph below shows the domestic demand and domestic supply for soybeans. Assume this country is open to international trade, that soybeans are a perfectly competitive good, and that the world...
-
Purpose Statement The purpose of this qualitative study will understand how organizations can retain and grow long-term employees without spending excessive money on recruiting employees that will...
-
A missile is fired off the surface of the Earth with speed v at a 45 degree angle. It reaches a maximum height above the surface of 6,370 km (which is coincidentally equal to the radius of the...
-
From your Soil Assignment, and watching the video "Kiss the Ground" - Answer the following: 1) What impact does this have on individuals, communities, businesses? 2) What did you learn that surprised...
-
A company with a cost of capital of 10 percent has non-postponable investment opportunities with the estimated cash flows shown below (figures in Tshs million). Year 0 1 7 8 Project A (1,000)...
-
In the design challenge assignment, you must include the following: Describe your problem. What is the problem you are trying to solve? My problem is: elderly people facing difficulties in using...
-
Q1.Assume that you have attended an interview for the post of Accountant in Sohar Aluminum Company S.A.O.C. The first round of the interview is written test and the following questions has been asked...
-
Using thermodynamic data from Appendix 4, calculate G at 258C for the process: 2SO 2 (g) + O 2 (g) 88n 2SO 3 (g) where all gases are at 1.00 atm pressure. Also calculate DG8 at 258C for this same...
-
Plot the polynomial y = 0.lx5 - 0.2x4 -x3 + 5x2 - 41.5x + 235 in the domain -6 < x < 6 . First create a vector for x, next use the polyval function to calculate y, and then use the plot function.
-
The velocity of a skydiver whose parachute is still closed can be modeled by assuming that the air resistance is proportional to the velocity. From Newton's second law of motion the relationship...
-
Plot an ellipse with major axes of a = 10 and b = 4 and a center at x = 2 and y = 3.
-
True or false? Explain: modularity reduces complexity because A. It reduces the effect of incommensurate scaling. B. It helps control propagation of effects.
-
True or false? Explain: hierarchy reduces complexity because A. It reduces the size of individual modules. B. It cuts down on the number of interconnections between elements. C. It assembles a number...
-
If one created a graph of personal friendships, one would have a hierarchy. True or false?
Study smarter with the SolutionInn App