CIS 2003 - Introduction to C++ and C Programming
Bob Comer, Professor, CIS/CSC
Assignment 3 - Checkbook Balancing
Write a C++ program to help you balance your checkbook at the end of the month. The program should have the user enter the initial balance followed by a series of transactions.
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: service charges are not deducted from the account balance until 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 output 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: Ó2000 by the Austin Community College
Department of Computer Studies. All rights reserved.
Comments to: Bob Comer
Last updated: February 9, 2000