language c program used is dev c++ this is similiar to another question asked on
ID: 3565996 • Letter: L
Question
language c
program used is dev c++
this is similiar to another question asked on here.
Modified saving calculator
How do I enter the principal,years,minmum rate and maximum rate?
The modified savings calculator program is shown in Fig. 8-32 in the chapter. Enter the C++instructions from the figure into a source file named Introductory19.cpp. Change the filename int he first comment. Save and run the program. The output is shown in Figure 8-33 i the chapter. Replace the for statement with a while statement, and then save and run the program.
*(FIG. 8-32 IS Listed Below)*
//Modified Savings Calculator.cpp - displays the balance
//in a savings account at the end of 1 through 5 years
//using interest rates of 3%, 4%, and 5%
//Created/revised by on
#include
#include
#include
using namespace std;
int main()
{
int principal = 1000;
int years = 1; //counter
double balance = 0.0;
do //begin loop
{
cout << "Year" << years << ":" << endl;
for (double rate = .03; rate < .06; rate +=.01)
{
balance = principal * pow(1 + rate, years);
//display rate with zero decimal places
cout << " Rate" << rate * 100 << "%: $";
//display balance with two decimal places
cout << setprecision(2) << balance << endl;
} //end for
//update years counter
years +=1;
} while (years < 6);
system("pause");
return 0;
} //end of main function
Explanation / Answer
#include #include #include using namespace std; int main() { int principal = 1000; int years = 1; //counter double balance = 0.0; do //begin loop { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.