Project Individual A student opens a savings account with RM1000 at the beginnin
ID: 3919504 • Letter: P
Question
Project Individual A student opens a savings account with RM1000 at the beginning of January. He then makes a deposit of RM100 at the end of each month for the next 4 months (starting at the end of January). Interest is calculated and added to his account at the end of each month (before the RM 100 deposit is made). The monthly interest rate depends on the amount A in his account at the time whern interest is calculated, in the following way: A s 1200 1 percent 1200 1400:3 percent Please write a report and submit it next week. Please 1) Calculate manually 2) Draw flow chart 3) Write a program. 4) Show the output.Explanation / Answer
#include <iostream>
using namespace std;
// main function definition
int main()
{
// Initial amount
double principal = 1000;
double interest;
// Loops 4 times for 4 months
for(int x = 1; x <= 4; x++)
{
// Displays month number
cout<<" Month - "<<x;
cout<<" Beginning Month Principal: "<<principal;
// Checks if principal amount is less than or equals to 1200
if(principal <= 1200)
// Calculate 1% interest
interest = principal * .001;
// Otherwise checks if principal amount is less than or equals to 1400
else if(principal <= 1400)
// Calculate 2% interest
interest = principal * .002;
// Otherwise more than 1400
else
// Calculate 3% interest
interest = principal * .002;
// Adds the interest to principal
principal += interest;
cout<<" After Interest Added Principal: "<<principal<<" Interest: "<<interest;
// Deposit 100
principal += 100;
cout<<" After Deposit Principal: "<<principal;
}// End of for loop
}// End of main function
Sample Output:
Month - 1
Beginning Month Principal: 1000
After Interest Added Principal: 1001 Interest: 1
After Deposit Principal: 1101
Month - 2
Beginning Month Principal: 1101
After Interest Added Principal: 1102.1 Interest: 1.101
After Deposit Principal: 1202.1
Month - 3
Beginning Month Principal: 1202.1
After Interest Added Principal: 1204.51 Interest: 2.4042
After Deposit Principal: 1304.51
Month - 4
Beginning Month Principal: 1304.51
After Interest Added Principal: 1307.11 Interest: 2.60901
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.