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. UML CLass Diagram: SavingsAccount Inherits BankAccount Structure of the Fields As described by the UML Class Diagram above, your SavingsAccount 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 returns nothing - a public method named account Info 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 currentBalance, but only if the amount is not more than the currentBalance. This method should return true if the amount was subtracted from the currentBalance, otherwise it should return false. - The applyinterest method should compute the interest amount and add this amount to the currentBalance, but only if the currentBalance is greater than \( 0 . \) - The accountInfo method will return a string formatted exactly like this: Type of Account : Savings Account ID : 1111-2222-3333-4444 Current Balance : \( \$ 123.45 \) interest rate: \( 1.50 \% \)
As described by the UML Class Diagram above, your SavingsAccount 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 apply Interest that takes no arguments and returns 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 currentBalance, but only if the amount is not more than the currentBalance. This method should return true if the amount was subtracted from the currentBalance, otherwise it should return false. - The applyinterest method should compute the interest amount and add this amount to the currentBalance, but only if the currentBalance is greater than \( 0 . \) - The accountInfo method will return a string formatted exactly like this: Type of Account : Savings Account ID : 1111-2222-3333-4444 Current Balance : \( \$ 123.45 \) Interest rate : \( 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. - The debit method will return false if an attempt to overdraw the account is made.
Current file: SavingsAccount.java \( \nabla \) Load default template... 1 // Implement your SavingsAccount class in this file|
Current file: BankAccount.java - Load default template... \( 1 / \) Copy and paste the code for your BankAccount class \( 21 / \) into this file 3
\begin{tabular}{l|l} 1 & public class Main \{ \\ 2 & public static void main(String[] args) \{ \\ 3 & \\ 4 & \} \\ 5 & \} \end{tabular}