Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[Q.1] Define an( interface BankAccount) with the following methods: a. deposit ( double amount) adds an amount to the balance b. withdraw ( double amount)

[Q.1] Define an( interface BankAccount) with the following methods: a. deposit ( double amount) adds an amount to the balance b. withdraw ( double amount) subtracts an amount from balance c. getBalance() returns the balance Then, write the class (StandardAccount) that implements BankAccount with encapsulated attribute called balance that shows the balance amount in a standard bank account. This class has the following methods: a. transfer( BankAccount account, double amount) transfers the amount from this object to account object. You should reuse the methods defined above. b. toString( ) returns all the information regarding this account. Next, write the class (CheckingAccount) that implements BankAccount with encapsulated attributes along with balance: 1. transactionCount which counts how many transactions occurred 2. Constant integer FREE_TRANSACTIONS which is initialized to 3 3. Constant double TRANSACTION_FEE which is initialized to 2.0 This class has the following methods: a. transfer( BankAccount account, double amount) transfers the amount from this object to account object. You should reuse the methods defined above. b. deductFees() deduct fees from the balance if the number of transactions exceed the number of free transactions. c. toString( ) returns all the information regarding this account.

Then, write( BankTest )class that creates two bank accounts: one for standard account and other for checking account with initial balance $500.00 and $200.00 respectively that have been input from the user. Then, implement the following transactions: 1- Transfer $100.00 from standard account to checking account 2- Deposit $300.00 to checking account 3- Withdraw $500.00 from the standard account 4- Transfer $150.00 from checking account to standard account 5- Deposit -$100.00 to standard account Last, print all the accounts information before your program terminates

. Make sure all the double precision formats are correct.

//======== this program should have 1) INTERFACE 2) 2 CLASSES WITH THEIR OWN METHODS 3) A MAIN CLASS

please help me with it in java programing language

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

Students also viewed these Databases questions