Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following program uses Sequential Control Structure five times. Using Sequen

ID: 3646822 • Letter: T

Question

The following program uses Sequential Control Structure five times. Using Sequential flow of structures, this program calculates simple interest on certain given amount, at certain rate of interest and years. Read the program first to select the name of the variables and their appropriate data types. Write, compile, and execute a C++ program that displays the following prompts to cin indicated value: Enter the rate of interest (float): Input 3.0 as rate of interest. Enter the $ Amount Deposited (float): Input 1000.00 as amount. Enter the number of years the amount is deposited for: Input 1 as number of years Then the program should calculate the simple interest using the formula: Interest = Amount * Ratelnterest * Years The program should add calculated Interest to variable Total Amount (Amount due at the end after adding an original amount and the calculated interest). Now the program should display the rate of interest, amount deposited, and number of years input from the keyboard each on a separate line with appropriate text messages. Then print calculated simple interest on a separate line, with two decimal places, and in 15 spaces. Repeat above steps 1 to 6 for the following values: Interest Rate 3.5 4.0 4.5 5.0 Amount 2000 3000 4000 5000 Year 2 3 4 5

Explanation / Answer

please rate - thanks

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{float rate, deposit,due,interest,total;
int years,i,j;

for(i=1;i<=5;i++)
    {cout<<"Enter interest rate; ";
    cin>>rate;
    cout<<"Enter the $ amount deposited: ";
    cin>>deposit;
    cout<<"Enter years deposited for: ";
    cin>>years;
    interest=deposit*(rate/100.)*years;
    total=deposit+interest;
    cout<<"Interest rate: "<<rate<<"% "<<endl;
    cout<<"Amount deposited: "<<deposit<<endl;
    cout<<"Number of years: "<<years<<endl;
    cout<<"Interest due: "<<setw(15)<<setprecision(2)<<fixed<<interest<<endl;
    cout<<"total due: "<<setw(15)<<setprecision(2)<<fixed<<total<<endl<<endl;
    }
system("pause");
return 0;
}