Question: #Java program BankAccount SavingAccount AnnualInterestRate: double # accountName: String # account Number: int # account Balance: double + BankAccout() + BankAccount (accountName: String, accountNumber: int,

 #Java program BankAccount SavingAccount AnnualInterestRate: double # accountName: String # account

Number: int # account Balance: double + BankAccout() + BankAccount (accountName: String,

#Java program

BankAccount SavingAccount AnnualInterestRate: double # accountName: String # account Number: int # account Balance: double + BankAccout() + BankAccount (accountName: String, accountNumber: int, accountBalance: double) + SavingAccount() + SavingAccount (accountName: String, account Number: int, accountBalance: double AnnualInterestRate: double) + calculateMonthlyInterestRate(): double + toString(): String java.lang. Comparable K. + compareTo (o : Object): int Write a complete program for the SavingAccount class and test program based on the Figure 1 and the following requirements: Create a SavingAccount class that derived from BankAccount. This class inherits all data fields from its superclass and also has its own data field named AnnuallnterestRate. This data field is used to hold the value of annual interest rate. Besides that, the SavingAccount has two constructors, calculateMonthlyInterestRate() method and toString() method. The calculateMonthlyInterestRate() method returns the calculation result of monthly interest rate by using the following formula: AnnualInterestRate / 12 * accountBalance. The toString() method will return the information of SavingAccount object. The SavingAccount class will implement the compareTo() method from Comparable interface to compare the monthly interest rate of the two objects. This method returns 1 if the monthly interest rate of the first object is larger than the second object, return -1 if smaller than the second object and return O if both objects have the equal monthly interest rate. Write a test program that creates two objects of SavingAccount with any values of the accountName, account Number, accountBalance and AnnuallnterestRate. Display information for the both objects including the monthly annual interest and the result of comparison

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!