Create the logic for a program that calculates and displays the amount of money
ID: 3546312 • Letter: C
Question
Create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest rate for one year. Create a seperate method to do the calculation and return the result to be displayed.
With further instruction via Professor: "I have one change to that program. Instead of calculating the return on investment for $5000 at 2%, you will allow the user to enter an amount invested and interest rate.
Your program must have the following characteristics to earn full points.:
Explanation / Answer
#include<iostream>
using namespace std;
float calculate(int p,int r)
{
float interest,amount;
interest = (p*r)/100;
amount = p + interest;
return amount;
}
int main()
{
float rate,amount,principal;
cout<<" Enter the principal : ";
cin>>principal;
cout<<" Enter the rate : ";
cin>>rate;
amount = calculate(principal,rate);
cout<<"Amount : "<<amount;
return 0;
}