The program should then output the account number, account type, current balance, and an appropriate message. |
I hate assignments like this. What is an "appropriate message?"
"Can I interest you in a credit card?" - from the Bank's perspective, that's the most appropriate message.
"The current balance in your [checking|savings] account is $XYZ."
"If you make no changes, the balance at the end of this month will be $XYZ"
"If you make no changes, the balance at the end of the next 3 months will be $ABC, $DEF and $XYZ"
"If you make no changes, the balance at the end of the year will be $XYZ"
"If you make no changes, the balance after 263 years will be $QRS"
The prof probably wants the second message: what is the balance at the end of the month, after applying the service charge or interest payment.
To solve this, start by writing a program that accepts the input and simply prints out the account type minimum balance and current balance. There won't be any point in writing the code that calculates the new balance if you don't get the input correct.
Then, write a function that calculates the new balance from the account type, the current balance and the minimum balance:
double newBalance(char acctType, double curBalance, double minBalance);
Call this in your main program and adjust the output to print the new also.
Run a few test cases with trivial amounts to see if you have the right results.