Question: I need help making an array. I want to display an amortization table similar to the one below. ******************************************************************* ---------------- AmortizationSchedule---------------------------- ******************************************************************* Payment #|Payment Amount|Principle|Interest|Remaining

I need help making an array. I want to display an amortization table similar to the one below.

*******************************************************************

---------------- AmortizationSchedule----------------------------

*******************************************************************

Payment #|Payment Amount|Principle|Interest|Remaining Balance

###############################

###############################

###############################

###############################

###############################

###############################

###############################

###############################

--------------------------------------------------------------------------------------------------------------------------------------

#include

#include

#include

#include

using namespace std;

string choice;

int main()

{

cout << "Welcome to the financial calculator!"; // this is before the loop and will only appear once

cout << endl;

///////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

do// starts menu loop

{

cout << endl;

cout << "Would you like to solve for monthly payments (P), length of loan (L), or exit (E) ? ";

cin >> choice; // records user info for selected menu option

cout << endl;

///////////////////////

if (choice == "P" || choice == "p") // starts if statement - principle option

{

double I; // Interest

cout << "Enter the APR interest rate: ";

cin >> I; // records user input for interest

double L; // Length in months

cout << "Enter the length of loan in months: ";

cin >> L; // records user input for length

double P; // Principle

cout << "Enter the principle amount: ";

cin >> P; // records user input for principle

double monthlyInterest = I / 1200; // converts APR to deciaml format per month

double monthlyPayment = (monthlyInterest + (monthlyInterest / (pow(1 + monthlyInterest, L) - 1))) * P; // calculates monthly payment

cout << "Your monthly payment is: $" << monthlyPayment;

cout << endl;

cout << "---------------------------------------------------------------------"; // makes it easier to read

cout << endl;

NEED ARRAY HERE

}//////////////////////////////////////////////////////////////////////

else if (choice == "L" || choice == "l") // if length of loan option is chosen

{

cout << endl;

double I; // interest APR

cout << "Enter the APR interest rate: ";

cin >> I; // records user info for interest APR

double P; // principle amount

cout << "Enter the principle amount: ";

cin >> P; // records user info for principle amount

double D; // desired payment

cout << "Enter the desired monthly payment: ";

cin >> D; // records user info for desired monthly payment

double monthlyInterest = I / 100; // converts I into decimal format APR 6% --> 0.06

int pi = P * monthlyInterest;

int loanLength = ((log(D) - (log(D - pi / 12))) / (log(1 + monthlyInterest / 12))); // calculates length of loan

cout << "Your loan length is: " << loanLength << " months";

cout << endl;

cout << "---------------------------------------------------------------------"; // makes it easier to read

cout << endl;

}/////////////////////////////////////////////////////////////////////

else// if the choice is anything other than L, l, p, or P

return 0;

}

while (choice != "p" || choice != "P" || choice != "l" || choice != "L"); // end of loop

return 0;

}

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 Programming Questions!