Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

question shows as image called man assignment, you will implement Java applicar be used to manage bank accounts. The application is to be implemented using

question shows as image image text in transcribed

called man assignment, you will implement Java applicar be used to manage bank accounts. The application is to be implemented using three classes, called Account, Customer, and BankDriver. The description of these classes is below. Problem Description class Account The Account class keeps track of the balance in a bank account with a varying annual interest rate. The Account class is identified as follows: . . two double instance variables, called balance and annualRate. A constructor that takes two input parameters to initialize the balance and annualRate instance variables. No-argument constructor to set both the balance and annualRate to zero. Getters for both instance variables. 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. If the amount to be withdrawn is greater than the current balance, then the method displays as error message and does not change 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. For example, if the account's balance is 1000 and annualRate is 0.05, the call addInterest (3) will add 3-years-worth of interest (.e., 3*1000*0.05) to the current balance. (Note that interest calculations can be more complex if the second year's interest is to be calculated using the first's year balance after adding first year's interest and so on. However, for simplicity, you are not required to implement this more complex interest calculations). 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. . class Customer 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. Getter methods for the saving and checking accounts. 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. Note that account type is either 1 for saving account or 2 for checking account. The method then calls the appropriate Account's deposit method to add the specified amount of money. For example, the call creditAccount (1,500) adds 500 to the saving account while the call creditAccount (2,500) adds 500 to the checking account. The method should display an error message if the first input is any number other than 1 or 2. debitAccount: similar to creditAccount but it withdraws money form the specified account. addInterest: similar to creditAccount, this method 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 customer name, details of customer's accounts and customer's total balance. . class BankDriver Your driver class should do the following actions: creates two 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. Check whether the checking account of customer is equal to the checking account of the second cusomter. prints all customers' information in a nicely formatted output. Important Requirements The output of our program must be nicely formatted. The programs should display your name. At the top of the program include your name, a brief description of the program and what it does and the due date. Add appropriate comments to your code. All code blocks must be indented consistently and correctly. Blocks are delimited by opening and closing curly braces. Opening and closing curly braces must be aligned consistently. Variable names should convey meaning. Draw a UML diagram of your application that includes the Account and Customer classes but not the BankDriver class

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 For Small Business 2023

Authors: Martin J. Kallman

1st Edition

180171925X, 978-1801719254

Students also viewed these Databases questions