Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java application that meets the following requirements: Create three interfaces named Depositable , Withdrawable , and Balanceable that specify the methods that can

Write a Java application that meets the following requirements:

Create three interfaces named Depositable, Withdrawable, and Balanceable that specify the methods that can be used to work with accounts.

The Depositable interface should include this method: o public void deposit(double amount)

The Withdrawable interface should include this method: o public void withdraw(double amount)

The Balanceable interface should include these methods: o public double getBalance() o public void setBalance(double amount)

Create a class named Account that implements all three of these interfaces. This class should include an instance variable for the balance.

Create a class named CheckingAccount that inherits the Account class. This class should include an instance variable for the monthly fee thats initialized to the value thats passed to the constructor. This class should also include methods that subtract the monthly fee from the account balance and return the monthly fee.

Create a class named SavingsAccount that inherits the Account class. This class should include instance variables for the monthly interest rate and the monthly interest payment. The monthly interest rate should be initialized to the value thats passed to the constructor. The monthly interest payment should be calculated by a method that applies the payment to the account balance. This class should also include a method that returns the monthly interest payment.

Create a class named AccountApp that prompts the user to enter the initial values. Then, it asks for a transaction, posts the transaction, and displays the information on the console output. Basically, it includes the main method() and creates necessary objects for the transactions.

Your program should display the money amount properly with the dollar sign ($), cent amounts (two digit after decimal sign), and etc. And also, your program should display the interest rate percentage properly as well.

The following presents a sample run of your program. Based on the sample run, identify the detail operation of the application. Welcome to the Account application Enter initial checking amount: 1000.0

Enter initial saving amount: 1000.0

Enter checking fee: 1.0 Enter Saving interest: 0.01 OK! This is your information Checking Amount: $1,000.00 Savings Amount: $1,000.00 Checking Fee: $1.00 Interest Rate: 1% Enter the transactions for the month Withdrawal or deposit? (w/d): w Checking or savings? (c/s): c Amount?: 500 Continue? (y/n): y Withdrawal or deposit? (w/d): d Checking or savings? (c/s): s Amount?: 200 Continue? (y/n): n Monthly Payments and Fees Checking fee: $1.00 Savings interest payment: $12.00 Final Balances Checking: $499.00 Savings: $1,212.00

This is another sample run of your program.

Welcome to the Account application Enter initial checking amount: 200.0 Enter initial saving amount: 100.0 Enter checking fee: 2.0

Enter Saving interest: 0.1 OK! This is your information Checking Amount: $200.00 Savings Amount: $100.00 Checking Fee: $2.00

Interest Rate: 10% Enter the transactions for the month Withdrawal or deposit? (w/d): w Checking or savings? (c/s): s Amount?: 10 Continue? (y/n): y Withdrawal or deposit? (w/d): w Checking or savings? (c/s): s Amount?: 10 Continue? (y/n): n Monthly Payments and Fees Checking fee: $0.00 Savings interest payment: $8.00 Final Balances Checking: $200.00 Savings: $88.00

This is another sample run of your program.

Welcome to the Account application Enter initial checking amount: 150 Enter initial saving amount: 150 Enter checking fee: 1.5

Enter Saving interest: 0.15

OK! This is your information Checking Amount: $150.00 Savings Amount: $150.00 Checking Fee: $1.50 

Interest Rate: 15% Enter the transactions for the month Withdrawal or deposit? (w/d): d Checking or savings? (c/s): c Amount?: 100 Continue? (y/n): y Withdrawal or deposit? (w/d): w Checking or savings? (c/s): c Amount?: 100 Continue? (y/n): y Withdrawal or deposit? (w/d): d Checking or savings? (c/s): c Amount?: 10 Continue? (y/n): n Monthly Payments and Fees Checking fee: $4.50 Savings interest payment: $22.50 Final Balances Checking: $155.50 Savings: $172.50

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

Step: 3

blur-text-image

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

2. How were various roles filled?

Answered: 1 week ago