Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a) Design a class named BankAccount and its subclasses named SavingsAccount and CheckingAccount. Some fields of a BankAccount are account number and current balance. Withdrawals

a) Design a class named BankAccount and its subclasses named SavingsAccount and CheckingAccount.

Some fields of a BankAccount are account number and current balance. Withdrawals and deposits can be made to any BankAccount.

A SavingsAccount also has a field that stores interest rate. A SavingsAccount has the ability to increase the accounts balance by paying the monthly interest (which is based on the current balance and interest rate).

A CheckingAccount also has fields that store monthly fees and the minimum balance (which should be enforced when money is withdrawn from the account).

Keep in mind:

Use appropriate access specifiers for data members and methods of each class.

Provide accessor and mutator methods as you deem necessary.

Each class should have at least one constructor that receives arguments. The constructor of a subclass should directly initialize the base classs variables.

Each class should have its own toString and equals methods.

If a subclass has a more specific way of implementing functionality that is in the seperclass, it should override the method.

b) Create a driver program with an array of BankAccounts and populate it with both types of BankAccounts. Write a loop to go through the array of BankAccounts and print the state of each object (using the appropriate toString method).

c) Write code to go through the array of BankAccounts. It should calculate the total amount of money currently in the CheckingAccounts in the array of BankAccounts (and ignore the money in the SavingsAccounts in the array).

This question is for java programming.

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

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions

Question

Recognize and describe the steps in the recruiting process

Answered: 1 week ago

Question

Be familiar with the five basic ways to manage demand.

Answered: 1 week ago