My Code for Interest Rate

Bracelets
Kinship Dies in Darkness
1 min readOct 1, 2017

#include “stdafx.h”

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

double startBalance;

double interestRate;

int years;

cout << “ Hello “ << endl << endl;

cout << “What is your starting balance for your Bank Account? “ << endl;

cin >> startBalance;

cout << “What is your interest rate? “ << endl;

cin >> interestRate;

cout << “How many years do you plan on keeping your account open? “ << endl;

cin >> years;

for (int i = 0; i < years; i++) {

startBalance = startBalance* (1 + interestRate / 100.0);

}

cout << “After “ << years << “ years, you will have a new balance of : $ “ << startBalance << endl << endl;

cout << “ Lets see a range of intrests rates and how they affect your balance after one year. “ << endl << “ Please enter min and max interest rates “;

double secondInterestRate;

cin >> interestRate >> secondInterestRate;

double newBalance;

for (double i = interestRate; i <= secondInterestRate; i = i + 0.5) {

newBalance= startBalance* (1 + i / 100.0);

cout.setf(ios::fixed); cout.precision(2);

cout << setw(3) << “[“ << i << “] = “ << “$ “ << newBalance << endl;

}

system(“pause”);

return 0;

--

--