COSC 1320 - C++ Programming and
ITSE 1307 - Introduction to C++ Programming
Bob Comer, Professor of Computer Studies
Assignment 3 - Checkbook Balancing Revisited
Read through Chapter 6 in your textbook before starting this assignment.
Modify your checkbook balancing program from assignment 2 as follows:
- The user should enter the transaction type and amount (if required) on a single line. In other words, there should not be a separate prompt message for the transaction amount.
- Use a separate function to process each transaction type (check or deposit).
- Add additional service charges (see below).
The program commands are as follows (see the sample program dialog near the bottom of this page).
Transaction command |
Meaning |
C amount |
Process a check for amount dollars, where amount is a floating-point number. |
D amount |
Process a deposit for amount dollars, where amount is a floating-point number. |
E |
End the program. |
Service Charges
- There is a $0.25 service charge for each check written.
- If the account balance falls below $800.00 at any time during the month, there is a $5.00 service charge for the month.
- If the account balance becomes negative, there is an additional $25.00 charge per check until the balance becomes positive again.
- Note: all service charges should be deducted from the account balance at the end of the month.
Output
For each transaction, print
- the command data (to confirm the transaction)
- the resulting account balance
- the total service charges accrued so far
At the end of the month, deduct the service charges and print the final balance. Your program dialog should look something like this example (user input is shown in bold).
Enter the beginning balance: 900
Enter a transaction: C 50.25
Processing check for $50.25
Balance: $849.75
Service charge: $0.25 for a check
Total service charges: $.25
Enter a transaction: C 250
Processing check for $250.00
Balance: $599.75
Service charge: $0.25 for a check
Service charge: $5.00 balance below $800.00
Total service charges: $5.50
Enter a transaction: D 200
Processing deposit for $200.00
Balance: $799.75
Total service charges: $5.50
Enter a transaction: E
Processing end of month
Final balance: $794.25 |
Other requirements
- Do not use global variables in any assignment. A global variable is a variable that is declared outside any function.
- All input should be checked for reasonable values.
- All dollar amounts should be printed with 2 decimal places.
- Write a separate function to process each of the transaction types (check or deposit).
Return to C++ Home Page
Copyright: 2005 by the Austin Community College
Department of Computer Studies. All rights reserved.
Comments to: Bob Comer
Last updated: August 25, 2005