Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create a customer class and the a date class In this lab you will change BankAccount class to abstract and derive two concrete classes from

create a customer class and the a date class 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

In this lab you will change BankAccount class to abstract and derive two concrete classes from Employee called ChequingAccount and SavingsAccount. The abstract BankAccount class will declare an abstract method called withdraw() The subclasses of BankAccount will provide different implementations of these methods. You will then create a new program called BankAccountReporter that manipulates an array that contains both ChequingAccount and SavingsAccount objects. Step 1 In a new folder, create a modified version BankAccount class. The new version is abstract and defines an abstract method called withdraw. Then derive the two new classes ChequingAccount and SavingsAccount . Here are the UML diagrams for your reference: Class Relationships: BankAccount Class Diagram: Customer and Date remain unchanged *Notice the italicized class name and withdraw() method. These will be declared using the keyword abstract. //and set new lastTransaction date //only set positive amounts +transfer( amount : float, otherAccount : BankAccount, lastTransaction : Date) + withdraw(amount: float) - ChequingAccount(accountNumber : int, customer : Customer, lastTransaction : Date, balance : float, overDraftPenalty : float, overDraftLimit : float) - getOverDraftPenalty( () : float - setOverDraftPenalty(overDraftPenalty : float) - getOverDraftLimit() : float - setOverDraftLimit(overDraftLimit : float) + withdraw(amount: float) Step 2 Now create the BankAccountReporter program. This program will allow the user to perform operations on an array that contains both ChequingAccount and SavingsAccount objects. It will do this by leveraging the "is-a" relationship these classes have with Employee and the polymorphic invocation of the withdraw() method. 1. It will use an array of BankAccount objects called accounts, declared like this: static BankAccount[] accounts; 2. In the main method populate the array with the following data. Notice that we are putting ChequingAccount and SavingsAccount into the same array of type BankAccount. (You can copy and paste this data) 3. Display all Accounts will list all accounts in the following format: AccountNumber: customerld, lastName, firstName middlelnit. balance Follow the list with a total balance row. 4. Display accounts by customerld prompts the user for a customerld and then displays a list with the same format as in 4 above, but only for accounts associated with the selected customerld. Total balance of all accounts. 5. Display all savings accounts under their min balance 6. Display all chequing accounts that are breaking their overdraft limit 7. Deposit - prompt user which accountNumber to deposit into 8. Withdraw prompt user accountNumber to withdraw from 9. Transfer - prompt user for accountNumber to withdraw from and deposit into

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

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions