Code a Mortgage calculator
using c++ and Microsoft visual Studio create a new project called exercise2 and use the code attached as exercise2.cpp.
This mortgage calculation program obtains from the user a number of parameters including size of the loan, number of years, percent yearly interest rate, and the number of payments per year. It then calculates the size of the payments and the total paid over the life of the loan. (Note that the user enters percent annual interest rate while the formula uses decimal interest per year! Pay attention to variable names.)
Remember to test your program by trying all different possible combinations of input. When testing your program, be sure to enter some incorrect data, such as text instead of numbers, decimal percentage rate instead of integer percentage rate, and unfilled fields to witness how the program behaves. Your program does not have to correct for bad input, but it should accept interest as percent per year.
Note that the quantity within the parentheses is raised to the negative of the total number of payments. As a test case, a $100,000 loan at 8% for 15 years has a payment of $955.65 per month. Note that the factor formula uses the decimal interest per payment, not the percent interest per year obtained from the user.
Note: if x and y are doubles, then pow(x, y) will raise x to the power of y.
When you are finished, exercise2.cpp and submit it.
sample code:
/***********************************************
* mortgage Calculator. <your name> <date> Given principle amount, percent interest
* per year, loan duration in years, and number of payments per year, calculates
* the payment size. Note intercap naming convention and CONSISTANT abbreviations(!)
* code modified from code provided by David Beard.
*/
#include <iostream> // includes system I/O software
using namespace std; // eliminates the need for std::
int main()
{
double loanAmount;
double percentInterestRatePerYr; // if abbreviate year w/ yr, they always use yr
long loanDurationInYrs;
long numPaymentsPerYr;
double paymentSize = 42;
double decIntRatePerPayment;
long totalNumOfPayments = 42;
double factor;
double totalOfAllPayments;
// obtain information from user
cout << "Mortgage Calculator V1.0" << "\n";
cout << "Please enter the Principal: ";
cin >> loanAmount;
cout << "Please enter the interest rate: ";
cin >> percentInterestRatePerYr;
// add code to obtain loan duration and number of payments per year from user
// calculate intermediate results for the following:
decIntRatePerPayment =
totalNumOfPayments =
factor =
paymentSize =
totalOfAllPayments =
// display results to user
cout << "The payment size is: " << paymentSize << "\n";
// add a cout for the total of all payments
return(0);
}
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- LOTTERY Bill buys 10 lottery tickets which he plays randomly. Let us write a C# program for Bill that suggests random numbers for him. After the winning numbers are drawn, the program informs Bill of the results of each lottery ticket. There are 5 winning numbers in one lottery ticket. Each number is from 1 to 90.arrow_forwardSummary 2 HouseSign.py - This program calculates prices for cu house signs. In this lab, you complete a prewritten Python program for a carpenter who creates personalized house signs. The program is supposed to compute the price of any sign a customer orders, based 4 on the following facts: 5 # Declare and initialize variables here. 6 # Charge for this sign. • The charge for all signs is a minimum of $35.00. # Number of characters. 8 # Color of characters. • The first five letters or numbers are included in the minimum charge; there is a $4 charge for 9 # Type of wood. 10 each additional character. 11 # Write assignment and if statements here as appropr • If the sign is make of oak, add $20.00. No charge is added for pine. 12 13 # Output Charge for this sign. • Black or white characters are included in the minimum charge; there is an additional $15 14 print("The charge for this sign is $" + str(charge)) charge for gold-leaf lettering. 15 Instructions 1. Make sure the file HouseSign.py…arrow_forwardObject-Oriented Programming ❤❤❤ Matchmaker with Java ❤❤❤ Summary: Create a Java application that will determine your true love. Prerequisites: Java, VS Code, and Terminal In this assignment you will develop and test a command-line application written in the Java language that asks questions to determine if a person is your true love. More specifically your application should ask five questions in the form of statements and allow the user to respond to each statement with the numbers 1 through 5 with 1 indicating strongly disagree and 5 indicating strongly agree. You will then compare the person’s answers with your desired “true love” answers. The closer the answers are to your desired “true love” answers the better match the two of you are for each other. For example, suppose you choose the statement “Broccoli is delicious.” and your desired answer was 1 (strongly disagree) because you really don’t like broccoli. If the application user entered 4 (agree), then the two of you would not…arrow_forward
- Subject: programming language : c++ Question : Jane has opened a new fitness center with charges of 2500 per month so the cost to become a member of a fitness center is as follow :1.For senior citizens discount is 30 %2. For young one the discount is 15 %3. For adult the discount is 20% Write a menu driven program (using structure c++) thata. Add a new memberb. Display the general information on about the fitness center and its chargesc. Determine the cost of a new membershipd. At any time show the total money made.Use appropriate parameters to pass information on and out of a function.arrow_forwardPlease written by computer source Unit 4 - Lab – Individual Retirement Account Calculation Assignment An Individual Retirement Account (IRA) is a special bank / brokerage account that a person can use to save money for retirement. An individual can put up to $5,500 per year tax free and the money grows tax free until the person is ready to retire. The tax rules related to IRA’s are complex, but for this assignment, we’ll assume that the person puts in the same amount of money every year (up to $5,500) and the money grows at a constant interest rate. Write a Flowgorithm program that asks the user to input an annual IRA contribution (in dollars), and interest rate (percent), and a time period (years). Calculate the value of the IRA every year for the duration of the time period provided by the user. Be sure and provide user friendly prompts. Include a comment at the beginning of the program with your name, date, and a short description of the program.arrow_forwardA(n) on its own but can be used with other software products. _is a small application that cannot runarrow_forward
- Please help with this code and make sure to create in c++. Make sure it is 100% correct and works on Visual studios. Thxs. Write the code as described in the questions below. Submit your code electronically in the box at the bottom. You may only use Java, C# or C++. The economy is defined using a 2-dimensional data structure: A “payday” will be considered to be any region of $ values where all cells in the region are connected either vertically or horizontally. For example, the following illustrates a matrix with 5 rows and 8 columns containing three objects. $’s and P are used in the diagram to represent the two types of values: PPPP$PPPPPP$$PPPPP$$PPP$PP$PPPP$P$PPP$$$ a) Write a program to read in the data from the text file and store it into a data structure. Your program should output it to the screen after it has read in the file. (If you can’t get this to work hard-code the above example and continue to part b). Here is a sample text file (containing the above data):…arrow_forwardC++. Please do not change the existing code. The instructions are in the image that is provided. Please zoom in or you can download the png file. Thank you! Time.cpp #include "Time.h" //Default Constructor //Constructor with parameters int Time::getHour() const { return hour; }int Time::getMinute() const { return minute; }int Time::getSecond() const { return second; }void Time::setHour(int h) { hour = h; }void Time::setMinute(int m) { minute = m; }void Time::setSecond(int s) { second = s; } int Time::timeToSeconds() const{ return (getSecond() + getMinute() * 60 + getHour() * 3600);} const Time Time::secondsToTime(int s) const{ int resultS = s % 60; s /= 60; int resultM = s % 60; s /= 60; int resultH = s % 24; return Time(resultH, resultM, resultS);} //toString // + // - // < // > // == ------ Time.h #ifndef TIME#define TIME #include <string> using namespace std; class Time{private: int hour; int minute; int second; int timeToSeconds() const;…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY