In: Computer Science
This is a c++ questions that calculates the investments/ loans. Below is the sample output, which have few scenerios.
Enter how much money you will be putting towards
loans/retirement each month: 500
Enter how much you owe in loans: 40000
Enter the annual interest rate of the loans: 0.03 Enter your
minimum monthly loan payment: 405.32 Enter your current age: 22
Enter the age you plan to retire at: 65 Enter the annual rate of return you predict for your investments: .05 You should only make the minimum payments on your loan and apply the rest towards retirement. If you do you will have $592888.96 when you retire as opposed to $587281.54 if you payed off your loan before investing.
Enter how much money you will be putting towards
loans/retirement each month: 1053
Enter how much you owe in loans: 50000
Enter the annual interest rate of the loans: 0.06 Enter your
minimum monthly loan payment: 350 Enter your current age: 25
Enter the age you plan to retire at: 70 Enter the annual rate of return you predict for your investments: 0.05 You should apply all $1053.00 towards your loan before making any investments.
If you do you will have $1651149.44 when you retire as opposed to $1619732.68 if you only made minimum payments.Enter how much money you will be putting towards loans/retirement each month: 50
Enter how much you owe in loans: 1000 Enter the annual interest rate of the loans: 0.05 Enter your minimum monthly loan payment: 400 You didn't set aside enough money to pay off our loans. Ending program.
Enter how much money you will be putting towards
loans/retirement each month: 500
Enter how much you owe in loans: 10000
Enter the annual interest rate of the loans: .02 Enter your minimum
monthly loan payment: 100 Enter your current age: 18
Enter the age you plan to retire at: 20 Enter the annual rate of return you predict for your investments: 0.07 Warning! After you retire you will still have $7961.19 in loans left. You should only make the minimum payments on your loan and apply the rest towards retirement. If you do you will have $10272.41 when you retire as opposed to $1835.38 if you payed off your loan before investing.
Enter how much money you will be putting towards
loans/retirement each month: bob
Enter how much money you will be putting towards loans/retirement
each month: cat
Enter how much money you will be putting towards loans/retirement each month: -3 Enter how much money you will be putting towards loans/retirement each month: 250
Enter how much you owe in loans: something Enter how much you owe in loans: 25 boys Enter how much you owe in loans: 1000 Enter the annual interest rate of the loans: ziggy Enter the annual interest rate of the loans: -3 Enter the annual interest rate of the loans: .1 Enter your minimum monthly loan payment: 50 50 Enter your minimum monthly loan payment: 25
Enter your current age: -5 Enter your current age: 20 Enter the age you plan to retire at: 18 Enter the age you plan to retire at: 65 Enter the annual rate of return you predict for your investments: -8 Enter the annual rate of return you predict for your investments: 0.04 You should apply all $250.00 towards your loan before making any
investments. If you do you will have $371259.10 when you retire as opposed to $370579.15 if you only made minimum payments.
Copyable Code:
#include <iostream>
using namespace std;
void main()
{
double money = 0.0;
double Ol = 0.0;
double aIR = 0.0;
double mMP = 0.0;
double Rr = 0.0;
double money_save = 0.0;
double cA = 0.0;
int PAge = 0;
int RAge = 0;
//initialiese loop variable
int i = 0;
cout<<"\nEnter how much money you will be putting towards loans/retirement each month";
cin>>money;
cout<<"\nEnter how much you owe in loans";
cin>>Ol;
cout<<"\nEnter the annual interest rate of the loans:";
cin>>aIR;
cout<<"\nEnter your minimum monthly loan payment:";
cin>>mMP;
cout<<"\nEnter your current age:";
cin>>PAge;
cout<<"\nEnter the age you plan to retire at:";
cin>>RAge;
cout<<"\n Enter the annual rate of return you predict for your investments";
cin>>Rr;
cout<<"\n";
for(i = 0; i < (RAge - PAge) * 12; ++i)
{
if(Ol > 0) {
cout<<"\n Month:"<<i+1;
cout<<"\n Current savings:"<<money_save;
cA = money_save * (Rr/12);
money_save += cA;
money_save += (money - mMP);
if(mMP > Ol) {
money_save += -(Ol - mMP);
Ol = 0;
}
else
{
Ol+= (Ol * aIR/12);
Ol -= mMP;
}
cout<<"\nLoans owned:"<<Ol;
cout<<"After interest savings:"<<money_save;
cout<<"Compound amount:"<<cA;
}
else
{
cout<<"\n Month"<<i+1;
cA = money_save * (Rr/12.0);
money_save += money;
money_save += cA;
cout<<"\nCurrent savings:"<<money_save;
cout<<"\nLoans owned:"<<Ol;
cout<<"After interest savings:"<<money_save;
cout<<"\n Compunded amount:"<<cA;
}
}
cout<<"\nSavings:"<<money_save;
if(mMP * (RAge - PAge) * 12 >= Ol) {
cout<<"\n Do minimum payments on loan and remaining towards retirement.";
}
else
{
cout<<"Apply all"<<money<<"towads loan";
}
system("pause");
}