go to previous page   go to home page   go to next page


Not quite. We need to know more about how deposits and checks are processed.

More Requirements

The requirements describe what each method does. The method to accept a deposit adds an amount (in cents) to the current balance. The current balance can be negative or positive.

The method to process a check subtracts the amount of the check from the current balance. Overdrafts are allowed, so the balance can become negative. However, if the balance is less than $1000.00 before the check is processed, $0.15 is charged for each check.

To simplify the program, assume that all data is correct (so the methods do not check for errors).

It is time to think about design. The first thing to do is sketch out the class definition:

class CheckingAccount
   instance variables declarations




Although Java syntax does not require it, it is helpful to put different parts of a class definition in different sections, as above.


Think of a reasonable variable name (identifier) and data type for each variable:

Account number.
Name of account holder.
Current balance.