The following two programs comes from Chapter 7 in your textbook. Due Monday February 16th, 2009. Please upload both as one project and make sure to zip it before using FTP. P7.2 Implement a class Purse. A purse contains a collection of coins. For simplicity, we will only store the coin names in an ArrayList void addCoin(String coinName)Add a method toString to the Purse class that prints the coins in the purse in the format Purse[Quarter,Dime,Nickel,Dime]Use the following class in your solution: import java.util.ArrayList; Use the following class as your tester class: /** | ||
P7.3
| Write a method reverse that reverses the sequence of coins in a purse. Use the toString method of the preceding assignment to test your code. For example, if reverse is called with a purse Purse[Quarter,Dime,Nickel,Dime]then the purse is changed to Purse[Dime,Nickel,Dime,Quarter]Use the following class in your solution: import java.util.ArrayList; Use the following class as your tester class: /** |
No comments:
Post a Comment