SLIDE 5 Solutions to Chapter 14 Exercises 5
- For the savings accounts, you can make a maximum of three
withdrawals in a month without incurring a fee. The bank charges $1.00 for every withdrawal after the third.
- For the checking accounts, the bank charges $0.50 for every
check you write for the first 20 checks (i.e., withdrawals) in a
- month. After that, there will be no charge.
You should be able to open and save account information to a file. You should be able to list all transactions of a given account or of all ac-
- counts. Include appropriate menus to select the options supported by the
- program. Consider using the Date class to record the date of transac-
- tions. The Date class is from the java.util package. Please refer to a ja-
va.util reference manual for information on this class.
14.8.
Extend the address book sample program from Chapter 9. Instead of managing a single type of Person, incorporate additional types of per- sons such as PersonalFriend, BusinessAssociate, etc. Define these classes as a subclass of Person. Design carefully to decide whether the
Person class will be an abstract class or not.
14.9.
Consider an asset tracking program that will track four types of assets: electronic appliances, automobiles, furniture, and compact discs. What classes would you design for the program? Would you define four unre- lated classes or one superclass and four subclasses? If you design a su- perclass, will it be an abstract superclass? An abstract superclass Asset with four subclasses Appliance, Automo-
bile, Furniture, and CompactDisc is a good design. Any number of dif-
ferent asset types may be added in the future by subclassing Asset and implementing any abstract methods it declares.
14.10.
Implement the asset tracking program of exercise 9. Allow the user to add, modify, and delete electronic appliances, automobiles, furniture, and compact discs. Allow the user to list the assets by category and search for an asset by its serial number.
14.11.
Extend the asset tracking program of exerci se10 by adding an object I/ O capability.
14.12.
Write an application that reads daily temperatures for 12 months and al- lows the user to get statistics. Support at least three options: monthly av- erage of a given month, yearly average, and lowest and highest temperatures of a given month. Use a textfile to store temperatures. A line in the textfile contains daily temperatures for one month. The first line in the textfile contains temperatures for January, the second line for