Question
You will write a program to calculate a students savings. It will ask the user for the amount of pay earned during a month and
- You will write a program to calculate a students savings. It will ask the user for the amount of pay earned during a month and the amount spent by the student, which includes amount spent on rent, groceries, transportation, entertainment and miscellaneous. Once the amount of pay earned and the amount of each item have been entered, the program will calculate and display the students savings.
The output should be well formatted. Your program should have a block comment at the start of the program and appropriate comments at key places in the program.
Create a New Project in Visual Studio and name it Savings and save it in your chosen location. Write the C++ code.
ALGORITHM
Students Savings
Calculate Students Savings
- Get Data from user
- Calculate the students savings
- Display the students savings
- Get Data from user
1.1 Display a message on the screen asking What is the students pay amount for this month?
1.2 Once the user enters a number for the amount of pay, store it in memory (use the payAmount variable)
1.3 Display a message on the screen asking What is the amount spent on rent?
1.4 Once the user enters a number for the amount spent, store it in memory (use the rentAmount variable)
1.4 Display a message on the screen asking What is the amount spent on groceries?
1.5 Once the user enters a number for the amount spent, store it in memory (use the groceriesAmount variable)
1.6 Display a message on the screen asking What is the amount spent on transportation?
1.7 Once the user enters a number for the amount spent, store it in memory (use the transportationAmount variable)
1.8 Display a message on the screen asking What is the amount spent on entertainment?
1.9 Once the user enters a number for the amount spent, store it in memory (use the entertainAmount variable)
1.10 Display a message on the screen asking What is the amount spent on miscellaneous items?
1.11 Once the user enters a number for the amount spent, store it in memory (use the miscellaneousAmount variable)
- Calculate the students savings
2.1 Calculate the total amount spent
Add each of the amounts spent to obtain the total; store the result in memory (use the totalSpent variable)
2.2 Subtract the total amount spent from the pay amount, and store the result in memory (use the amountSavings variable)
- Display the student savings
3.1 Display a message Students savings: and the amount of savings calculated in step 2. Format the output, displaying the decimal point and two digits.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started