Start BlueJ and open the simpleAccount
project on the G: drive (see G:/Lintont/introcs/chapter2/). Save this
project to your H: drive folder for this class. Read the project
description and comments within the Account class to get a feel for
what an Account object is suppose to do. You will be asked to complete
the source code for this class, and will hand in via blackboard your
final source code file Account.java.
- The file Account.java provides one constructor with three
parameters. One parameter for each field. Complete the second
constructor by making up reasonable values for each of the three
fields. This second constructor will have no parameters. You will
simply select specific values for balance, interestRate, and
maxWithdrawl, and your constructor should set each field of an Account
object to your selected values.
- Complete the accessor method getInterestRate by defining its
body. This method should return the current value of the field
interestRate.
- Complete the accessor method for the maximal withdrawl amount by
writing its header and removing the "instruction comments".
- Write standard mutator methods for the interestRate and
maxWithdrawl fields.
- Write a deposit method. This method should take one parameter
(the amount of the deposit) and add this parameter to the balance field.
- Write a printAccount method (with no parameters and no return
value) that "prints" an account summary to the standard terminal
window. Try to have this method print a blank line, followed by the
following sort of information (where the current values of the object's
fields are inserted for the question marks). Don't worry about trying
to "clean up" the printing of doubles. It is OK if your printing method
produces number values like $456.8 or $456.123123123123123.
ACCOUNT SUMARY
Balance: $152.33
Annual Interest Rate: 5.0%
Maximum Withdrawl Amount: $200