Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

***This MUST be done in Visual Studio 2010*** Open Visual Studio on your PC and

ID: 3675514 • Letter: #

Question

***This MUST be done in Visual Studio 2010***

Open Visual Studio on your PC and select to create a New Project, name the new project CarPayment, and set the Location to save to your flashdrive to your folder called MyProgramProjects.

Now, write a program that does the following:

Print a message to the screen "Welcome to our car loan payment program... "

Print a message to the screen "The interest rate of our car loans is 5 percent. "

Print a message to the screen "Enter the amount of money you need to borrow: "

Read that value in as a double and store it in a double variable namedloanAmount . (you will need to create this variable at the top of your main program)

Print a message to the screen "Enter the term of the loan in months- enter 36 or 48 or 60: "

Read that value in as an int and store it in an int variable named loanTerm. (you will need to create this variable at the top of your main program)

Now call the function calculateCarPayment and store the value that will be returned by this function in a double variable called payment, like this:payment=calculateCarPayment(loanAmount, loanTerm); (you will need to create this variable at the top of your main program)

Print a message to the screen ("Your monthly loan payment will be: %.2f", payment);

After your main program, you will need to write the code for the function calculateCarPayment. It will calculate the amount of the car payment then it will return this value back to the main program. this can be done in one line like thisreturn ((loanAmount*1.05)/loanTerm);

Don't forget to add a line at the very top: #include "stdafx.h" (needed for VisualStudio software). Also don't forget to include your function prototype at the top of the program.

Explanation / Answer

#include <iostream>
#include <stdio.h>
#include "stdafx.h"
using namespace std;

double calculateCarPayment(double loanAmount, double loanTerm);

int main(){
   double namedloanAmount, loanAmount, payment;
   int loanTerm;
   cout << "Welcome to our car loan payment program... ";
   cout << "The interest rate of our car loans is 5 percent. ";
   cout << "Enter the amount of money you need to borrow: ";
   cin >> loanAmount;

   cout << "Enter the term of the loan in months- enter 36 or 48 or 60: ";
   cin >> loanTerm;

   payment = calculateCarPayment(loanAmount, loanTerm);
   printf("Your monthly loan payment will be: %.2f", payment);
}

double calculateCarPayment(double loanAmount, double loanTerm){
   return ((loanAmount * 1.05) / loanTerm);
}