Usetutoringspotscode to get 8% OFF on your first order!

  • time icon24/7 online - support@tutoringspots.com
  • phone icon1-316-444-1378 or 44-141-628-6690
  • login iconLogin

java program

Base Class
Write an Account class containing an instance variable called balance with an accessor called getBalance and mutators called deposit and withdraw. To allow members of the Account class to be sorted, implement the java.lang.Comparableinterface to compare two accounts using balance.

Derived Classes
Create two subclasses of Account calledSavingsAccount and CheckingAccount. SavingsAccount will add an instance variable called interest to store interest percentage and a mutator method for increasing its balance by applying the interest called compound().
CheckingAccount will keep track of check numbers using an instance variable called nextCheckNumber starting with 1000. It will have a method called orderChecks that increments the current check number instance variable by 1000.
To facilitate displaying account information each of these accounts should override the toString() method from the java.lang.Object class.
Driver
All of your classes should include constructors that yield properly initialized accounts. Your driver should test your SavingsAccount and CheckingAccount classes by creating an ArrayList of Account and adding a number of SavingsAccount and CheckingAccount objects with various balances. All methods and constructors should be called at least once and your ArrayList should be passed as an argument to java.util.Collections.sort().

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes