Programming and Problem Solving with Java

(やまだぃちぅ) #1
321

The user should be allowed to enter one of the bets, and the application should
use the Math.randommethod as the basis for computing the number that would
be rolled on the wheel. It should then compare this number to the bet, and re-
port whether it won or lost. The process repeats until the user closes the appli-
cation window.

2.Develop the responsibility algorithms for the CRC card design of Programming
Problem 1 and code the application. Use the scenarios to design the test plan.


3.Use the CRC card process to design an extension to the application of
Programming Problem 1. The new application should allow the user to enter an
initial amount of money into an account. In addition to placing a bet, the user
should be able to specify an amount to go with the bet; this amount should be
deducted from the account. Any winnings should be added to the account. The
current winnings or losses (difference from the original amount) should be dis-
played as well as the value of the account. Winnings are computed as follows:
Single-number bets pay 36 times the amount placed.
Row bets pay 12 times.
Column bets pay 3 times.
Odd/even, red/black, and high/low half-bets pay 2 times the amount.
The user should not be allowed to bet more than the total in the account.


0

1 2 3

4 5 6

7 8 9

10 11 12

13 14 15

16 17 18

19 20 21

22 23 24

25 26 27

28 29 30

31 32 33

34 35 36
Free download pdf