Design, write and compile, and execute a C++ program that calculates and display
ID: 3883733 • Letter: D
Question
Design, write and compile, and execute a C++ program that calculates and displays the amount of money, A, available in N years when an initial deposit of X dollars is deposited in a bank account paying an annual interest rate of R percent. Use the relationship that A = X(1.0 + R/100)N. The program should prompt the user to enter appropriate values and use cin statements to accept the data. Use statements such as Enter the amount of the initial deposit in constructing your prompts. Verify the operation of your program by calculating, by hand and with your program, the amount of money available for the following test cases:
Explanation / Answer
Program:
#include<iostream>
using namespace std;
int main()
{
double A,N,R,X;
cout<<"Enter initial deposit(X) : ";
cin>>X;
cout<<" Enter rate of interest in percent(R) : ";
cin>>R;
cout<<" Enter number of years(N) : ";
cin>>N;
A = X*(1.0 + (R/100))*N;
cout<<" Amount of money(A) = "<<A<<endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.