Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

OBJECTIVE The main objective of this assignment is to enforce the basic object-oriented design and implementation concepts that we will be using in the remainder

OBJECTIVE The main objective of this assignment is to enforce the basic object-oriented design and implementation concepts that we will be using in the remainder of this course. In this assignment, you will design and implement a Java application, called BankApplication, that can be used in a Bank. You are asked to implement three classes: Account, Customer, and BankDriver. The description of these classes is described below.

PROBLEM DESCRIPTION Account class The Account class keeps track of a balance in a bank account with a varying annual interest rate. The account is identified by two double instance variables, balance and annualRate. Implement the following methods for the Account class: A constructor to initialize the balance and annualRate to some given values. No-argument constructor to set both the balance and annualRate to zero. Getters for both balance and rate. deposit: a method than takes an amount (of type double) and adds that amount of money to account's balance. withdraw: a method than takes an amount (of type double) and withdraws that amount of money from the balance. addInterest: a method that adds interest to the balance at the current rate. The method takes an input (of type int) indicating how many years-worth of interest to be added. equals: a method to test the equality of two accounts. Two accounts are considered to be equal if they have the same balance and the same annualRate. toString: a method that returns a nicely formatted string description of the account.

Customer class: The Customer class represents a bank customer. A customer is identified by the following instance variables: name: a string that represents customer name checkingAccount: an instance variable of type Account savingAccount: an instance variable of type Account Implement the following methods for the Customer class: A constructor that takes as input only the customer's name and creates a customer with zero balance and zero rate in both accounts. A constructor that takes five inputs that represent the customer's name and four double variables that represent the customer's checking account's balance, checking account's annual rate, saving account's balance, and saving account's annual rate. getTotalBalance: a method that calculates and returns the total balance of a customer (which is the sum of the checking account's balance and the saving account's balance). creditAccount: a method that takes two inputs to represent the account type and an amount of money to deposit. The method then adds the input deposit to the specified account. Note that account type is either 1 for saving account or 2 for checking account. debitAccount: similar to creditAccount but it withdraws money form the specified account. addInterest: a method that takes as input account type and number of years. The method then adds interest to the specified account. toString: a method that returns a string representation of the customer that includes only customer name and the customers total balance.

BankDriver class: Your driver class should do the following actions: creates three customers with your choice of names, balances, and annual rate values. adds 1 year-worth of interest to all checking accounts. adds 3 years-worth of interest to all saving accounts. prints all customers information in a nicely formatted output.

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago