Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ST8132: Object Oriented Programming---JAVA Lab 5 (Assignment 1) Bank Simulator Class Assian1: This class will contain method main which will contain the menu. Class Person:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

ST8132: Object Oriented Programming---JAVA Lab 5 (Assignment 1) Bank Simulator Class Assian1: This class will contain method main which will contain the menu. Class Person: * This class will contain common data members for a person - firstName, lastName, phoneNumber, emailAddress. . Methods: o constructor () to create accHolder object o Required getter:s Class BankAccount: . This class will be the base class and contain the common data members for all Bank Accounts (ie accountNumber accHolder, balance). Here, accHolder is an object of class Person . Methods: o toString):String - returns the data of the account formatted to display t): boolean an prompts user to enter data for this object from keyboard - edits data, and doesn't allow user to continue with bad data o updateBalance (double) updates the balance in the object by the parameter amount o monthlyAccountUpdate() - processes the object with monthly update (make it abstract for base class.) Class SavingsAccount: . This class will be inherited from BankAccount and contains the data members for a savings account (ie double interestRate, double minimumBalance) . Methods: o toString(): String - returns the data of the account formatted to display o addBankAccount(): boolean - prompts user to enter data for this object from keyboard edits data, and doesn't allow user to continue with bad data o monthlyAccountUpdate) - processes the object with monthly update of adding interest (as long.as bank balance is more than minBalance, else displays error message Class ChequingAccount: . This class will be inherited from BankAccount and contains the data members for a chequing account (ie double fee) Methods o toString): String - returns the data of the account formatted to display o addBankAccount): boolean- prompts user to enter data for this object from keyboard - edits data, and doesn't allow user to continue with bad data o monthlyAccountUpdate) processes the object with monthly update of withdrawing the fee (as long as bank balance is more than fee, else displays error message) Class Bank: . This class will contain the array of BankAccount objects (which are instantiated with either SavingAccount or ChequingAccount objects); You wil need to keep two ints as well - a maxSize and numAccounts Methods o constructor () - allocates default size of 1000 o constructor (int)-parameter is size of array to be allocated o a ddAccount.boolean- success add or not; prompts user to enter data for an account which is added to array - either chequing or savings account is added if there is room o displayAccount() - String - prompts user to enter an account number to display, then returns data formatted to display or an error message. This should use toString) from BankAccount class. o printAccountDetails() - prints details of all accounts o updateAccount()- prompts user to enter which account number to update, and by how much and then updates the balance appropriately - returns success message or error message o findAccount) :int - prompts user to enter which account number they wish to find and returns array index of where it is found otherwise returns -1 o monthlyUpdate()- process through each current account in the array and updates the balance appropriately Sample Output new account u: Update an account d: display an account p: Print all accounts m: Run monthly update q: Quit Enter your option a: Add new account u: Update an account d: display an account p: Print all accounts : Run monthly update q: Quit Enter your option : Enter details of account holder 1 Enter details of account holder 2 Enter account type (s for savings, c for checking): Enter account type (s for savings, c for checking) Enter account number 100 Enter first name of account holder Enter account number 101 Enter first name of account holder Sam Enter last name of account holder Enter last name of account holder homas Enter phone number: 6132221234 Enter Email address: anu@anu.com Enter opening balance 1000 Enter minimum balance: 200 eorge Enter phone number: 6134441234 Enter Email address: sam@sam.com Enter opening balance 2000 Enter monthly fee Enter interest rate (should be a number in (,1)10 0.2 a: Add new account u: Update an account d: display an account p: Print all accounts m: Run monthly update q: Enter your option a: Add new account u: Update an account d: display an account p: Print all accounts m: Run monthly update : Quit Enter your option it

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

More Books

Students also viewed these Databases questions

Question

Explain how cultural differences affect business communication.

Answered: 1 week ago

Question

List and explain the goals of business communication.

Answered: 1 week ago