Question: Problem Description and Given Info You must write a public class named SavngsAccount with fields and methods as defined below, and that inherits from (extends)


Problem Description and Given Info You must write a public class named SavngsAccount with fields and methods as defined below, and that inherits from (extends) the BankAccount class. \begin{tabular}{|l|} \hline \multicolumn{1}{l|}{ Inherits/Extends } \\ \hline \multicolumn{1}{|c|}{ SavingsAccount } \\ \hline +debit(pennies:int):boolean+applylnterest()+accountInfo():String \\ \hline \end{tabular} UML CLass Diagram: SavingsAccount Inherits BankAccount Structure of the Fields As described by the UML Class Diagram above, your Savings Account class must have the following fields: - The SavingsAccount class has no required fields. Structure of the Methods As described by the UML Class Diagram above, your SavingsAccount class must have the following methods: - a public method named debit that takes an int argument and returns a boolean - a public method named applyInterest that takes no arguments and retums nothing - a public method named accountinfo that takes no arguments and returns a string Note that these three methods are defined as abstract in the BankAccount base class. You will be overriding and implementing these methods in this SavingsAccount concrete derived class. Behavior of the Methods - The debit method should subtract the argument amount from the balance, but only if the amount is not more than the balance. This method should return true if the amount was subtracted from the balance, otherwise it should return false. - The applyinterest method should compute the interest amount and add this amount to the balance, but only if the balance is greater than . - The accountinfo method will return a string formatted exactly like this: TypeofAccountAccountIDCurrentBalance:$123.45Interestrate:Savings:1111222233334444:1.508 Additional Information BankAccount Class Copy and paste your BankAccount class code from your Bank Account (Individual Assignment) into the BankAccount. Java file in the editor below. All Bank Accounts 1. All accounts have balance, credit and debit amounts, and fees stored and passed as a number of pennies (int). 2. All debit amounts will be subtracted from the balance, and all credit amounts will be added to the balance. 3. All bank accounts have a non-negative interest rate (0.02 would be a 2% interest rate). 4. When applying interest, interest amount is calculated by multiplying the balance by the interest rate. 5. When applying interest, interest amount is always added to the balance, and any fractional part will be rounded down. 6. Interest will not be applied to any Savings or Checking account with a balance of zero or less. 7. Debit methods will return false if the transaction cannot be made because of insufficient balance or insufficient credit limit. Otherwise they will return true. 8. The credit method will always return true. Savings Accounts 1. A SavingsAccount cannot have a negative balance
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
