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

#include<iostream> #include<string> #include<fstream> #include<vector> /*HW: Create two more functions, Modify the posted grade example that uses...
#include<iostream> #include<string> #include<fstream> #include<vector> /*HW: Create two more functions, Modify the posted grade example that uses dynamic arrays and file I/O to include the following: -Use vectors -read from values from the file and store them in the vector. Modify the function getGrades Extend the program to also include the following features: -A menu option that allows the user to add more students and there grades. Assume the number of quizzes stay the same based on the value read from...
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...
Create a c++ program to compute the product of two integers. call create the following functions:...
Create a c++ program to compute the product of two integers. call create the following functions: 1. getNum - to accept only positive numbers && will call computeProd. 2.computeProd - to compute the product of the numbers & will call the function displayProduct. 3. displayProduct - to display the product. Call the function getNum in the main function. Compute the product w/o using the multiplication operator(*). using #include <iostream> only
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...
C -Language Create a simple calculator that performs addition, subtraction, multiplication, and division. Your program should...
C -Language Create a simple calculator that performs addition, subtraction, multiplication, and division. Your program should prompt the user for the operation they wish to perform followed by the numbers they wish to operate on. You should have a function for each operation and use branches to determine which function to call. I need this to make any integers given, into decimal numbers, such as 3 to 3.0, or 2 to 2.0, also, so that I can multiply or add...
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...
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...
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:...
TASK: Using stack functions, write a program in C++ language that acts as a simple calculator,...
TASK: Using stack functions, write a program in C++ language that acts as a simple calculator, reading an infix algebraic expression with numbers and simple operations: +, -, *, / , (, and ). The program converts an infix expression into an equivalent postfix expression, and then evaluates the postfix expression, and then prints the result if input expression is correct otherwise prints error messages. Your program must interact with the user until the user quits.    REQUIREMENTS: - Your...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT