Question

In: Computer Science

Need to create Mortgage Calculator Program In C++ Modify your mortgage to include two functions. A...

Need to create Mortgage Calculator Program In C++

Modify your mortgage to include two functions.

  • A function to get principal, rate, and term.
  • A function to calculate monthly payment.

Test your program by getting the data from the user by using the first function and calculate monthly payment by calling the other function. Add version control and write proper comments with a few blank lines & indentations in order to improve your programming style.

Solutions

Expert Solution

#source code:

#include <math.h>

#include <iostream>

using namespace std;

void f1(); //function prototype for take user inputs

double f2(double,float,int); //function prototype for calculate monthly interest

void f1(void){ //function definition which is void type

double mortage;

float intrestRate;

int term;

//take user input

cout<<"Enter the mortage amount"<<endl;

cin>>mortage;

cout<<"Enter the intrest rate"<<endl;

cin>>intrestRate;

intrestRate=intrestRate/1200;

cout<<"Enter the term in years"<<endl;

cin>>term;

term=term*12;

cout<<"The calculated monthly payment is "<<f2(mortage,intrestRate,term)<<endl;

}

double f2(double mortage,float intrestRate,int term){ //function defintion for monthly interest

double monthlyPayment;

monthlyPayment=mortage*intrestRate/(1.0-pow(intrestRate+1,-term));

return monthlyPayment;

}

int main(){

f1(); //call the function

return 0;

}

#output:

#if you have any doubt or more information needed comment below..i will respond as possible as soon..thanks...


Related Solutions

Write a program in C++ Write three new functions, mean() and standard_deviation(). Modify your code to...
Write a program in C++ Write three new functions, mean() and standard_deviation(). Modify your code to call these functions instead of the inline code in your main(). In addition, add error checking for the user input. If the user inputs an incorrect value prompt the user to re-enter the number. The flow of the code should look something like: /** Calculate the mean of a vector of floating point numbers **/ float mean(vector& values) /** Calculate the standard deviation from...
write a C++ program to CREATE A CLASS EMPLOYEE WITH YOUR CHOICE OF ATTRIBUTES AND FUNCTIONS...
write a C++ program to CREATE A CLASS EMPLOYEE WITH YOUR CHOICE OF ATTRIBUTES AND FUNCTIONS COVERING THE FOLLOWING POINTS: 1) COUNTING NUMBER OF OBJECTS CREATED ( NO OBJECT ARRAY TO BE USED) USING ROLE OF STATIC MEMBER 2) SHOWING THE VALID INVALID STATEMENTS IN CASE OF STATIC MEMBER WITH NON STATIC MEMBER FUNCTION, NON STATIC MEMBERS OF CLASS WITH STATIC MEMBER FUNCTION, BOTH STATIC. SHOW THE ERRORS WHERE STATEMENTS ARE INVALID. 3) CALL OF STATIC MEMBER FUNCTION, DECLARATION OF...
Create a windows form application in C# that looks and functions like a basic calculator. It...
Create a windows form application in C# that looks and functions like a basic calculator. It must do the following: Add, subtract, multiply, and divide. Account for division by zero. Show at least two decimal places. Retain the last number on the window so that, when the user opens the calculator the next time, the number that was in the window at the last close appears. Have a memory, so that users can store values and recall them. Operate with...
Please C++ create a program that will do one of two functions using a menu, like...
Please C++ create a program that will do one of two functions using a menu, like so: 1. Do Catalan numbers 2. Do Fibonacci numbers (recursive) 0. Quit Enter selection: 1 Enter Catalan number to calculate: 3 Catalan number at 3 is 5 1. Do Catalan numbers 2. Do Fibonacci numbers (recursive) 0. Quit Enter selection: 2 Enter Fibonacci number to calculate: 6 Fibonacci number 6 is 8 Create a function of catalan that will take a parameter and return...
For this part you will need to use your calculator. What is the Monthly Mortgage Payment...
For this part you will need to use your calculator. What is the Monthly Mortgage Payment on a $125,000 Home with an 80% LTV with a 5% Interest Rate, 30-Year Fixed Rate Mortgage (Constant Payment Mortgage)? $536.82 What is the Monthly Mortgage Payment on a $125,000 Home with an 80% LTV with a 6% Interest Rate, 30-Year Fixed Rate Mortgage (Constant Payment Mortgage)? $599.55 How much more with the person with the mortgage in question #8 pay over the person...
In C Program #include Create a C program that calculates the gross and net pay given...
In C Program #include Create a C program that calculates the gross and net pay given a user-specified number of hours worked, at minimum wage. The program should compile without any errors or warnings (e.g., syntax errors) The program should not contain logical errors such as subtracting values when you meant to add (e.g., logical errors) The program should not crash when running (e.g., runtime errors) When you run the program, the output should look like this: Hours per Week:...
Time Calculator Create a C++ program that lets the user enter a number of seconds and...
Time Calculator Create a C++ program that lets the user enter a number of seconds and produces output according to the following criteria: • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds. • There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or...
Fat Percentage Calculator Create a C++ program that allows the user to enter the number of...
Fat Percentage Calculator Create a C++ program that allows the user to enter the number of calories and fat grams in a food. The application should display the percentage of the calories that come from fat. If the calories from fat are less than 30% of the total calories of the food, it should also display a message indicating the food is low in fat. One gram of fat has 9 calories, so: Calories from fat = fat grams *...
Your Task: Write a calculator Program with following functions (lack of function will result in a...
Your Task: Write a calculator Program with following functions (lack of function will result in a grade of zero). Your program must have the following menu and depending on the users choice, your program should be calling the pertaining function to display the result for the user. 1 - Add 2 - Subtract 3 - Multiply 4 - Divide 5 - Raise X to the power Y 6 - Finds if a number is even or odd 0 - Quit...
Your Task: Write a calculator Program with following functions (lack of function will result in a...
Your Task: Write a calculator Program with following functions (lack of function will result in a grade of zero). Your program must have the following menu and depending on the users choice, your program should be calling the pertaining function to display the result for the user. 1 - Add 2 - Subtract 3 - Multiply 4 - Divide 5 - Raise X to the power Y 6 - Finds if a number is even or odd 0 - Quit...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT