Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a main program that reads commands from bank2.txt and carries out the commands using objects of these classes. *MUST USE* ifstream textFile(bank2.txt); New Commands


Implement a main program that reads commands from bank2.txt and carries out the commands using objects of these classes.

*MUST USE*ifstream textFile(\"bank2.txt\");

New Commands

Checking account initialBalance minimumBalance monthlyFee

Savings account initialBalance minimumBalance annualInterestRate

Deposit account amount

Withdraw account amount

Balance account

Close

Report

1.Implement a main program whichreads commands from a fileand carries them out.

2. Valid account numbers are 1-9. This requires the program to have an array of references to Account objects.

3. If the first word on any line contains a command other than the four listed above, an error message should be displayed and that line ignored.

4. The create command creates a new account object with the given account number and initial balance. If an account already exists with that number an error message should be displayed and the command ignored.

5. The Deposit and Withdraw commands perform the indicated operation on an existing account. If no account with that number has been created, an error message is displayed and the command ignored.

6. The Balance command displays the balance of the requested account. No change to the account occurs. If no account with that number has been created, an error message is displayed and the command ignored.

7. Test your program thoroughly. The instructor will use a different bank2.txt file to evaluate your program.

Absolute Requirements

? The Account class must be an abstract class with two pure virtual functions, closeMonth and accountString.

? The Savings and Checking classes must be subclasses of Account ? The bank must handle at least 10 accounts simultaneously with account numbers 1-9

? Do not duplicate the balance or ID fields in the subclasses

? The balance, withdrawal and deposit manipulation must use the methods in the base class Account.

? Each action must display appropriate messages indicating that the action was completed.

? The closeMonth and accountString functions must be called polymorphically. This means, they are called for each account without checking to see what kind of account it is being called on.

? An implication of the last point is that there will be a single array of Account objects, some of which are Checking accounts and some of which are Savings accounts.

bank2.txt

{

Savings 1 1000.01 1000.00 4.0

Checking 2 2000.02 2500.00 6.95

Savings 3 3000.03 2000 7.0

Deposit 1 11.11

Deposit 2 22.22

Withdraw 4 5000.00

Checking 4 4000.04 2000.00 11.99

Withdraw 1 0.10

Balance 2

Withdraw 2 0.20

Deposit 3 33.33

Withdraw 4 0.40

Bad Command 65

Close

Report

}

A working example of how this program should 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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

Sketch the graph of the inverse function. y A 3 y = f(x)

Answered: 1 week ago

Question

Describe visualization and how it can boost motivation.

Answered: 1 week ago