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...
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...
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...
C++ Download the attached program and complete the functions. (Refer to comments) main.cpp ~ #include #include...
C++ Download the attached program and complete the functions. (Refer to comments) main.cpp ~ #include #include #define END_OF_LIST -999 using namespace std; /* * */ int exercise_1() { int x = 100; int *ptr; // Assign the pointer variable, ptr, to the address of x. Then print out // the 'value' of x and the 'address' of x. (See Program 10-2) return 0; } int exercise_2() { int x = 100; int *ptr; // Assign ptr to the address of...
Modify HW#1. C++ use,Write a multithreaded program that tests your solution to HW#1. You will create...
Modify HW#1. C++ use,Write a multithreaded program that tests your solution to HW#1. You will create several threads – for example, 100 – and each thread will request a pid, sleep for a random period of time, and then release the pid. (Sleeping for a random period approximates the typical pid usage in which a pid is assigned to a new process, the process executes and terminates, and the pid is released on the process’ termination).On UNIX and Linux systems,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT