Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an derived class in Java according to Interface specifications given in UML.Implement base class Interfaces in java according to specifications given in UML.Problem Description

Write an derived class in Java according to Interface specifications given in UML.Implement base class Interfaces in java according to specifications given in UML.Problem Description and Given InfoYou must write a public class named CheckingAccount with fields and methods as defined below, and that inherits from (extends) the BankAccount class.CheckingAccount Inherits BankAccount Class DiagramUML CLass Diagram: CheckingAccount Inherits BankAccountStructure of the FieldsAs described by the UML Class Diagram above, your CheckingAccount class must have the following fields:a private field named overdraftFee of type int initialized to 0Structure of the MethodsAs described by the UML Class Diagram above, your CheckingAccount class must have the following methods:a public method named debit that takes an int argument and returns a booleana public method named setFee that takes an int and returns nothinga public method named getFee that takes no arguments and returns an inta public method named applyInterest that takes no arguments and returns nothinga public method named accountInfo that takes no arguments and returns a StringNote that three of these methods are defined as abstract in the BankAccount base class. You will be overriding and implementing these methods in this CheckingAccount concrete derived class.Behavior of the MethodsThe debit method should subtract the argument amount from the balance. The debit method should always return true.The setFee method should store the argument amount in the overdraftFee field.The getFee method should return the value stored in the overdraftFee field.The applyInterest method should compute the interest amount and add this amount to the balance, but only if the balance is greater than 0.The accountInfo method will return a string formatted exactly like this:Type of Account : CheckingAccount ID : 1111-2222-3333-4444Current Balance : $123.45Interest rate : 1.50%Overdraft Fee : $20.00Additional InformationBankAccount ClassCopy and paste your BankAccount class code from your Bank Account (Individual Assignment) into the BankAccount.Java file in the editor below.All Bank AccountsAll accounts have balance, credit and debit amounts, and fees stored and passed as a number of pennies (int).All debit amounts will be subtracted from the balance, and all credit amounts will be added to the balance.All bank accounts have a non-negative interest rate (0.02 would be a 2% interest rate).When applying interest, interest amount is calculated by multiplying the balance by the interest rate.When applying interest, interest amount is always added to the balance, and any fractional part will be rounded down.Interest will not be applied to any Savings or Checking account with a balance of zero or less.Debit methods will return false if the transaction cannot be made because of insufficient balance or insufficient credit limit. Otherwise they will return true.The credit method will always return true.Checking AccountsA CheckingAccount can have a negative balance.The debit method for the CheckingAccount will always return true.Any CheckingAccount debit that ends with a negative balance will incur an overdraftFee (i.e. the overdraftFee amount will be subtracted from the balance). A CheckingAccount debit will always succeed.Interest will not be applied to a CheckingAccountwith a negative balance.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions