Question: Description: Write a C++ program to keep track of the balance of a savings account along with its goal First the user will enter the

Description:

Write a C++ program to keep track of the balance of a savings account along with its goal

First the user will enter the goal for the savings account

The balance starts at zero

The user enters a menu choice and then an amount

For a menu choice of 1, add the amount to the balance

For a menu choice of 2, subtract the amount from the balance

For a menu choice of 3, apply that percentage of interest

For example, if the balance is $50 and the interest amount if 10, then 10% of $50 is 5. The new balance is $55 because $50 + $5 (interest) = $55

For a menu choice of 4, quit entering transactions

Do not prompt for the amount when quit was chosen

Print the balance after each transaction is completed

Afterwards print out "Congratulations!" if the goal was met and "Keep going" if the goal was not met

Sample Run #1 (bold, underlined text is what the user types):

Goal? 500 1=deposit, 2=withdraw, 3=interest, 4=quit? 1 Amount? 250 Balance $250 1=deposit, 2=withdraw, 3=interest, 4=quit? 2 Amount? 50 Balance $200 1=deposit, 2=withdraw, 3=interest, 4=quit? 3 Amount? 10 Balance $220 1=deposit, 2=withdraw, 3=interest, 4=quit? 1 Amount? 400 Balance $620 1=deposit, 2=withdraw, 3=interest, 4=quit? 4 Congratulations!

Test #1 - checks all output

Mini Test #2 output includes Balance $250 for the first balance printed

Mini Test #3 output includes Balance $620 for the final balance printed

Mini Test #4 output includes Congratulations for meeting the goal

Sample Run #2 (bold, underlined text is what the user types):

Goal? 200 1=deposit, 2=withdraw, 3=interest, 4=quit? 1 Amount? 50 Balance $50 1=deposit, 2=withdraw, 3=interest, 4=quit? 3 Amount? 5 Balance $52.5 1=deposit, 2=withdraw, 3=interest, 4=quit? 4 Keep going

Test #5 - checks all output

Mini Test #6 output includes Balance $52.5 for the final balance printed

Mini Test #7 output includes Keep going for not meeting the goal

I am writing a code to solve this equation. I have some of it done. the parts that I think I am having issues on is showing balance after every repeat of menu. I'm not sure if I have my interest correct. When I select 4 for 4=quit I need help to figure out how to make it say Congratulations! if end amount meats goal or Keep going if end amount does not meet goal. Please keep format the same and explain in simple terms what you did and why. Thank You!!

Here is my code I got done so far

#include #include using namespace std; const double interest_percent = 0.1; int main() { int menu; double goalNum; double amountNum; double balanceNum; double deposit; double withdraw; double interest; int quit; cout << "goal? "; cin >> goalNum; cout << endl; cout << "1=deposit, 2=withdraw, 3=interest, 4=quit? "; cin >> menu; cout << endl; cout << "Amount? "; cin >> amountNum; cout << endl; if (deposit == 1) { amountNum += balanceNum; } if (withdraw == 2) { amountNum -= balanceNum; } if (interest == 3) { (balanceNum * interest_percent) + balanceNum; } if (quit == 4) { cout << balanceNum >= goalNum << "Congratulations!" << balanceNum < goalNum << "Keep going" << endl; } cout << "1=deposit, 2=withdraw, 3=interest, 4=quit? "; cin >> menue; cout << endl; cout << "Amount? "; cin >> amountNum; cout << endl; cout << "Balance $" << amountNum << endl; return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!