Question: C++ ... the code below works fine... but I want it to work for as many years as I can... right now I am writing

C++ ... the code below works fine... but I want it to work for as many years as I can... right now I am writing out the code one year at a time, so i need a loop (later i will change it so that the user can choose as many years as they want to print out: cin). The loop needs to print out years - but the code works the math into months because it is compound interest... There is extra commented out stuff that I used to help make to program. I hope it helps instead of confuses you. The image at the bottom is what the program is suppose to look like according to the assignment. Thanks!

#include

#include

#include

#include

using namespace std;

int main()

{

double startInvest;

double mDeposit;

double newTotal;

double aInterest; //%

double convertInterest;

double newInterest;

double bigInterest;

double endClosing;

startInvest = 1.00;

mDeposit = 50.00;

aInterest = 5;

convertInterest = (aInterest / 100);

newInterest = (convertInterest / 12);

endClosing = (startInvest + bigInterest);

string headOne;

// string headTwo;

// string headThree;

// string headFour;

string headFive;

string headSix;

headOne = "Year |"; // 1-60 //1

//headTwo = "OpenAmount"; //startInvest //2

//headThree = "DepositAmount"; // mDeposit //3

//headFour = " NewTotal"; // startInvest + mDeposit //4

headFive = "Year End Interest |"; // bigInterest //5

headSix = "Year End Balance |"; // NewTotal + AddInterest //6

cout

//cout

//cout

//cout

cout

cout

for (int month = 0; month

newTotal = startInvest + mDeposit;

endClosing = newInterest + newTotal;

std::cout

if (month == 11){

cout

cout

newInterest; //--- need this after 12 months to print

cout

endClosing

}

if (month == 23){

cout

cout

newInterest; //--- need this after 12 months to print

cout

endClosing

}

if (month == 35){

cout

cout

newInterest; //--- need this after 12 months to print

cout

endClosing

}

if (month == 47){

cout

cout

newInterest; //--- need this after 12 months to print

cout

endClosing

if (month == 59){

cout

cout

newInterest; //--- need this after 12 months to print

cout

endClosing

}

newInterest = ((newTotal*convertInterest) / 12);

endClosing = (newTotal + newInterest);

startInvest = endClosing;

}

return 0; }

C++ ... the code below works fine... but I want it to

Balance and Interest with Additional Monthly Deposits Year Year End Balance Year End Earned Interest 1 $617.55 $16.55 2 $1265.65 $48.10 3 $1946.90 $81.25 4 $2663.01 $116.11 5 $3415.76 $152.75

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!