Test2
and save your class in a file named
Test2.java
.
Wallet
.
The class Wallet
is part of a package.
The jar sample2.jar
contains the code of all the classes in this package.
The API of this package can be found here.
Enter a coin:The entry has to be made on the same line as the prompt. Also read the entered coin. You may assume that the user will enter either penny, nickel or dime. (This is a precondition of your app.)
Here is a sample run:
Enter a coin: nickel
Coin
that corresponds to the entry by the user
and by adding it to the wallet. For example, the user enters
nickel then a Nickel
is created and added to the wallet.
More coins? (y/n)The entry has to be made on the same line as the prompt. Also read the entered reply.
Here is a sample run (including the output of previous phases and the input of the user):
Enter a coin: nickel More coins? (y/n) y
Here is a sample run (including the output of previous phases and the input of the user):
Enter a coin: nickel More coins? (y/n) Y Enter a coin: dime More coins? (y/n) y Enter a coin: nickel More coins? (y/n) y Enter a coin: penny More coins? (y/n) n
Wallet
that is randomly generated,
adding this random wallet to the wallet you created in the previous phases, and by printing
the coins of this wallet.
Here is a sample run (including the output of previous phases and the input of the user):
Enter a coin: nickel More coins? (y/n) Y Enter a coin: dime More coins? (y/n) y Enter a coin: nickel More coins? (y/n) y Enter a coin: penny More coins? (y/n) n ***** Penny Dime Dime Penny Penny Penny