Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program #4 Loops Description: Write a C++ program that will allow a teller at Kutztown Bank to calculate the final balance in a customers bank

Program #4 Loops

Description:

Write a C++ program that will allow a teller at Kutztown Bank to calculate the final balance in a customers bank account based on a series of transactions. The program should start by asking the user to enter the type of bank account (C for checking or S for savings capital letters) followed by the starting balance of the account.

The program will then present the user with a menu. The menu will be as follows:

D deposit

W withdraw

I add interest

Q quit program

Each menu item should perform the stated action and then display the new balance.

When the user quits the program, the final balance should be displayed to the screen.

If the user chooses to deposit or withdraw funds, the program must ask the user to enter the amount. There is no limit on deposits, however, the maximum amount allowed in one withdrawal is $300.00. If the user tries to withdraw more than $300.00, display an error message and do not withdraw any money. Similarly, if the user chooses to withdraw funds and the amount of withdrawal is greater than the current balance, display a message to the user stating there are insufficient funds and, again, do not withdraw any money.

If the user chooses to add interest, the following rules should be followed:

Checking accounts o Balances less than $3,000.00 - interest rate is 2.0% o Balances greater than $3,000.00 - interest rate is 2.5%

Savings accounts o Balances less than $10,000.00 - interest rate is 3.0% o Balances greater than $10,000.00 - the interest rate is 4.5%

Operation:

The overall operation is as follows do them in this order!

Ask for the account type S or C capital letters only. Output an error message and exit the program (return) on anything other than S or C.

Next, ask for and accept the starting balance.

Repeat the following steps unit directed to quit (when a Q is entered):

Print out the menu as given above.

Prompt for an action as directed in the menu again use capital letters!

Perform the requested action as described above.

When Q is entered, output the balance and exit the program.

Functions:

The program should define and use the following functions: getType: prompt for, and return the account type (S or C) getStart: prompt for, and return the starting balance menu: print out the menu, prompt for, and return, the users choice makeDeposit: make a deposit makeWithdrawal: make a withdrawal addInterest: add interest to the account

outputBalance: print out the current balance

You will need to figure out what each function should return as well as what information it requires as input. Some will return a char, others a numerical value. Some will need input like the current balance or the account type. Think it through

Structure:

The main routine should begin, as mentioned above, by getting the account type and starting balance. It should then go into a loop, printing out the menu, getting the users choice of action, and taking the action selected. All of these thing should be done by calling the functions defined above. So, inside the loop, you will need to make decisions as to which functions to call based on the users input. Again, the loop is in the main routine.

More:

Money should look like money with a $ and 2 decimal values to represent cents. ex: $500.00 or $234.17

Remember to follow the documentation requirements for both the program header and the functions and comment the code itself liberally.

Name the program: bank.cpp (no caps!)

Some test examples are on the next page

and dont forget to test for incorrect input

(bad account type, invalid menu selection, etc.)

Test Examples:

Run 1

Checking account, starting balance $199.45

Deposit $100.00 o Withdraw $300.00 o Withdraw $200.00 o Add interest o Deposit $250.00 o Quit Final balance: $351.44

Run 2

Savings account, starting balance $9750.00 o Add interest o Deposit $500.00 o Withdraw $300.00 o Withdraw $500.00 o Deposit $350.00 o Add interest o Deposit $100 o Quit

Final balance: $11169.16

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

here) and other areas you consider relevant.

Answered: 1 week ago