Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

I need to put a menu into my financial calculator I am creating in C++ and I am having trouble doing so, I have about 16 errors and can't figure out...

I need to put a menu into my financial calculator I am creating in C++ and I am having trouble doing so, I have about 16 errors and can't figure out how to fix all of them to make the program run. Here is the following code that I have:

#include "stdafx.h"

#include <iostream>

#include <algorithm>

#include <string>

#include <cstdlib>

using namespace std;

int main()

{

double monthlyPayment;

double balance;

double interestRate;

int month = 1;

while

char choice[2];

cout << "::Menu::nn"

<< "Option 1. Add customern"

<< "Option 2. Loan Summaryn"

<< "Option 3. Exit Programnn"

<< "Choice: ";

cin >> choice;

if (choice[0] == '1')

{

system("CLS");

cout << "Option 1nn";

system("PAUSE");

system("CLS");

}

else if (choice[0] == '2')

{

system("CLS");

cout << "Option 2nn";

system("PAUSE");

system("CLS");

}

else if (choice[0] == '3')

{

return 0;

}

else if (choice[0] > '3' || choice[0] < '1') //user input valadation

{

system("CLS");

cout << "Invalid Inputnn";

system("PAUSE");

system("CLS");

}

else

{

system("CLS");

cout << "Invalid Inputnn";

system("PAUSE");

system("CLS");

}

}

cout.setf(ios::fixed);//

cout.setf(ios::showpoint);

cout.precision(2);

cout << "Loan calculator with monthly interest and amount of months to pay off." << endl;

/*cout << "Enter the current balance of your loan: $";

cin >> balance;

cout << "Enter the interest rate (compounded monthly) : ";

cin >> interestRate;

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

cin >> monthlyPayment;

*/

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

cout << questions[i];

cin >> values[i];

}

interestRate = values[2];

monthlyPayment = values[1];

balance = values[0];

while (interestRate >= 1)

{

//values[2] = values[2] / 100;//values[2] will keep the interest rate

interestRate = interestRate / 100;

}

balance = balance * (1 + interestRate / 12) - monthlyPayment;

// this is where the program stops. 

cout << "After month 1 your balance is $" << balance << endl;

while (balance > 0)

{

balance = balance * (1 + interestRate / 12) - monthlyPayment;

month = month++;

balance = max(balance, 0.0);

cout << "After month " << month << ", your balance is : $" << balance << endl;

}

cout << "You have paid off the loan at this point. Congratulations!" << endl;

cin.get(); // just to wait to press a key at the end of program

cin.get();

return 0;

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question