Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the loan calculator, the program might ask the user if he or she wants to solve for monthly payment, loan amount, length of loan,

For the loan calculator, the program might ask the user if he or she wants to solve for monthly payment, loan amount, length of loan, or interest rate. The program would then ask for the required information and solve for the remaining value.

In the programming tutorial, you would add a tutorial on conditional expressions. You can then add simple multiple choice questions to test the user's understanding of the concepts. You might also want to break the tutorial into sections, and use conditional expressions to ask the user which tutorial they wanted to see (i.e., variable declaration, input/output, conditional expressions, etc.).

I need help with this course project. It must be done using C++. I am doing a loan calculator program.

Here is my code:

// Course project, financial calculator.cpp : Defines the entry point for the console application. //

#include "stdafx.h" #include #include

using namespace std; int nMonths = 0; float loanAmount; float totalPaid = 0.0f;

void process(){

float interestRate;

float monthlyPayment;

cout << "What is the amount of the loan?:$";

cin >> loanAmount; cin.ignore();

cout << "What is the interest rate on the loan?:$";

cin >> interestRate; interestRate /= 100; cin.ignore();

cout << "What is the desired monthly payment?:$";

cin >> monthlyPayment; cin.ignore();

while (monthlyPayment < loanAmount * interestRate / 12) {

cout << "Not a valid amount, Amount must be greater than $";

cout << (loanAmount * interestRate / 12) << endl;

cout << "What is the desired monthly payment amount? $";

cin >> monthlyPayment; cin.ignore();

}

float interestToAdd = 0.0f;

float remaining = loanAmount;

float toAdd = 0.0f;

cout<

cout << "Month" <<" (Interest Added)"<<" (Amount Paid)"<<" (Debt Remaining)" << endl;

while (remaining > monthlyPayment) {

interestToAdd = remaining * interestRate / 12;

nMonths++;

remaining += interestToAdd;

if (remaining > monthlyPayment) {

toAdd = monthlyPayment;

}

else {

toAdd = remaining;

}

cout << nMonths << " $" << interestToAdd << " $" << toAdd

<< " $" << remaining << endl;

totalPaid += toAdd;

remaining -= toAdd;

}

}

void displayResult(){

cout << endl << "Statistics about loan. " << endl;

cout << "Initial loan amount: $" << loanAmount << endl;

cout << "Total amount paid: $" << totalPaid << endl;

cout << "Time to pay off loan: " << nMonths << endl;

cout << "Overpay percentage: " << (totalPaid / loanAmount) << endl;

cin.ignore();

}

int main()

{

int ch;

do{

cout<

cout<<"1. Process Loan"<

cout<<"2. Display Result"<

cout<<"Enter your choice : ";

cin>>ch;

switch(ch){

case 1:

process();

break;

case 2:

displayResult();

break;

default:

cout<<" Entered Wrong Keyword.... Re-enter Again";

break;

}

} while(ch != '1' || ch != '2');

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 3 Lnai 6323

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

3642159389, 978-3642159381

More Books

Students also viewed these Databases questions

Question

Find the measure of x. 35 30

Answered: 1 week ago