Question: So I'm running with an issue for my C++ program This is what the assignment is: Write a C++ program to help you balance your
So I'm running with an issue for my C++ program
This is what the assignment is:
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. For each transaction, first have the user enter a transaction type. The valid transaction types are:
- C - process a check (subtract the check amount from the current balance)
- D - process a deposit (add the deposit amount to the current balance)
- E - do end of month processing and exit the program.
For checks and deposits, the user should be prompted to enter the transaction amount.
Service Charges
- There is a $0.35 service charge for each check written. Keep a running total of the service charges.
- Service charges are not deducted from the account balance until the end of the month.
Output
After each transaction, print
- the transaction type and amount (if applicable)
- 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).
| Checkbook Balancing Program Enter the beginning balance: 900 Commands: C - process a check D - process a deposit E - end the program Enter transaction type: C Enter transaction amount: 50.25 Processing check for $50.25 Balance: $849.75 Service charge: $.35 for a check Total service charges: $.35 Enter transaction type: C Enter transaction amount: 250 Processing check for $250.00 Balance: $599.75 Service charge: $0.35 for a check Total service charges: $.70 Enter transaction type: D Enter transaction amount: 200 Processing deposit for $200.00 Balance: $799.75 Total service charges: $.70 Enter transaction type: E Processing end of month Final balance: $799.05 |
Input validation
- If the transaction type is invalid, print an informative error message and have the user re-enter the transaction type.
- The transaction amount should be a positive number (larger than zero). If it is not, print an informative error message and have the user re-enter the transaction amount.
Other requirements
- Do not use global variables in any assignment. A global variable is a variable that is declared outside any function. Note: global constants are okay.
- All dollar amounts should be printed with 2 decimal places.
This is what i got so far and I'm not sure why its not continuing till the user chooses the E command
//This program allows the user to balance their checking account by //processing a check, depositing a check and end of month balance //*****************************************************************
#include
int main() { float balance; //Create variables for such the floating form of balance of account char acctTransaction; //Character variable for which user decides of a transaction float amount; // This will be the variable for how much the amount the user enters int endBalance = 0; //The endBalance will acrue the amount through out the program const float chargeFee = .35; //This will be a constant for the charging fee of .35 cents to process each check float serviceCharge; //The variable will store a running total of the service fees that are charged cout <<"Checkbook Balancing Program "; cout << "Please enter the beginning balance: "; //Have the user enter the account balance and assign to variable balance cin >> balance; //Create an error message if user inputs a negative number by using if-else statement //Display the menu commands to the user cout << "Commands: "; cout << "C - Process a check" <
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
