Calculation of mortgage interest rates

Assignment Help C/C++ Programming
Reference no: EM13857

The two major modifications are the instruction of pointers and the calculation of mortgage interest rates.

Requirements for Project:

1. When developing this project in a Win32 Console Applications that includes the precompiled headers, enter in the Name: box, PRJ2[Your Full Last Name][Your First Initial] with no spaces. An example using the your project assignment where the PRJ is for Project, the 2 for the second project, and the name is from your name would be PRJ2SmithX for a student named Xavier Smith. This convention is used as the file name for this assignment. You will name it with your name in place of the "SmithX" in PRJ2SmithX.

2. Change the various identifiers that are of the data type struct from arrays into pointers. [Review information at end of document about the use of pointers.]

3. Add to the menu two items: calculate a mortgage rate and add a mortgage account to a bank client.

4. Create a method that will offer the user multiple possibilities for principal amount, rate, and length of time for a mortgage. [See development at end of document for determining monthly mortgage payment.]

5. Develop an interactive section to accept the various parameters used to calculating the mortgage payment.

6. In the section on the mortgage loan, after calculating the mortgage payment display all the elements related to the mortgage payment in a formatted line.

7. After a decision is made for a monthly mortgage payment, place the payment into the new add mortgage account method making the payment a monthly withdrawal. [Will a new field be required to distinguish one time withdrawals and recurring monthly withdrawals?]

8. End the program with a message indicating the end of the program and the name of the financial institution used.

9. Once the assignment works correctly for all parts, create an image of the results from the Output window and name the file PRJ2SmithXDisplay for the displays of various sets of parameters for a mortgage payment. [Highlight the text from the beginning to the end of the process the copy and paste it into the above named file.]

10. The completed project consists of the C++ file (PRJ2SmithX.cpp) and the image file (PRJ2SmithXDisplay). Submit each of these files to your WebTycho Project 2 assignment area no later than the due date listed in the syllabus schedule.

Pointers

When declaring a variable of data type pointer, use the * in front of the variable name. These variables hold a memory location (like B45CDF), not an actual value like 30 or A:

int * Years;
char * Grade;

This tells the program that the value contained in the variable will be a memory address that points to the value at that memory address.

To obtain an actual memory address to use with this variable, the & or reference operator is used.

In the following example, a regular variable is declared. Whenever a variable is declared in a program, the operating system sets aside a memory location in the computer to hold whatever value of a given data type is placed in that memory location. So placing the & in front of a regular variable, tells the operating system that the program wants the memory location address and not the value contained in that memory location.

int LoanYears;
int * Years;

The following code assigns the memory location for the LoanYears variable to the pointer variable.

Years = &LoanYears;

Note: If the assignment was "Years = LoanYears;" a compiler error would occur since the LoanYears is of the wrong data type that Years. Years only accepts memory locations, not actual values.

To assign a value or change the value of LoanYears using the pointer instead of the actual variable, the following code is used:

*Years = 30;

equivalent to

LoanYears = 30;

NOTE: Among the symbols expected in the code are -> and the use of ++ with the pointer variable for the pointer to the struct.

Examples of pointers

// Basic pointer code

#include "stdafx.h"
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{

int FirstNumber, SecondNumber;
int * ptrNumber;

ptrNumber = &FirstNumber;
*ptrNumber = 10;
ptrNumber = &SecondNumber;
*ptrNumber = 20;
cout << "FirstNumber is " << FirstNumber << endl;
cout << "SecondNumber is " << SecondNumber << endl;

return 0;
}

Output:

FirstNumber is 10
SecondNumber is 20

// Pointers with an array

#include "stdafx.h"
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{

int NumbHold[5];
int * ptrNumb;

ptrNumb= NumbHold;
*ptrNumb= 10;

ptrNumb++;
*ptrNumb= 20;

ptrNumb= &NumbHold[2];
*ptrNumb= 30;

ptrNumb= NumbHold + 3;
*ptrNumb= 40;

ptrNumb= NumbHold;
*(ptrNumb+4) = 50;

for (int n=0; n<5; n++)
cout << NumbHold[n] << ", ";

cout << endl;

return 0;

}

Output:
10, 20, 30, 40, 50,

Return to text in document

Determining the monthly payment on a mortgage loan:

 The following is the formula that can be used to complete that calculation:

Monthly Payment =
Monthly Interest Rate / (1 - (1 + Monthly Interest Rate) -Payment Interval)) * Principal

Where

Monthly Interest Rate expressed as: Interest Rate / 100 / 12.
Payment Interval expressed as: Number of Years * Months of Year.
Principal is total amount of mortgage expressed without any comma separators or $ prefixing it.

An example for the above formula:

Rate: 7.75
Period: 360
Principal: $100,000

(7.75 / 100 /12) / (1 - (1 + 7.75 /100 / 12) ^ -(30 * 12) ) * 100000

The result of the above formula generates a value of 682.18. (Note that there is no formatting of the value.) The ^ is the symbol for an exponent that replaces the superscript in an actual formula.

In C++ you must declare variables for the rate, period, principal, and monthly payment. Each of these variables is prefixed with a data type. In this case the data types are limited to float for decimal-based numbers (interest rate and monthly payment) and int for whole numbers (payment interval and principal). NOTE: C++ in case sensitive so be sure the variable is the same in every instance.

Some of the Code:

Payment = ?? / (1 - pow((1 + ??), - ?? * 12)) * ??;
cout << "Your monthly mortgage payment is tiny_mce_markerquot; << ?? << endl << endl;

[Remember to have #include <math>

Test:

Rate Period Principal Monthly Payment
3.50% 30 years $350,000.00 1571.656
6.25% 15 years $275,000.00 2357.913
7.325% 30 years $468,000.00 3216.427*
5.50% 40 years $725,000.00 3739.335
8.125% 30 years $645,000.00 4789.107*

*Possible rounding error

Return to text in document

Reference no: EM13857

Questions Cloud

Application development and programming languages : Application Development and Programming Languages,  Programming languages have evolved since the First Generation Languages (1GLs) in the 1940s. The 1GLs were machine languages, which interacted directly with hardware. 2GLs were assembly languages. F..
Ticketseller : Use Visual basic 2010Visual Basic,  TicketSeller. This assignment will contain two (2) Parts: Event Planning Document and Coding phase. You must submit both parts as separate files for the completion of this assignment. Remember, you are only to de..
Discussion on national security : Discussion on  National Security and  Current Events – Nuclear Weapons and Nuclear Energy.
Evaluate the matrix of transformation : Evaluate the matrix of transformation
Calculation of mortgage interest rates : Instruction of pointers and the calculation of mortgage interest rates.
Write two short c programs and solve exam-style problem : Write two short C programs and solve four exam-style problems.
Wal-mart company financial analysis : Wal-Mart company Financial analysis
Prepare a report of on sbi : Describe and analyse the primary internal and external influences on State Bank of India.
Leadership research : Share an example of the Pygmalion effect you have observed in the past. What effect did the leader's or manager's expectations have on an employee's performance in the workplace?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Write the code

Write a program that allows an instructor to keep a grade book. Each students has scores for exams, homework assignments, and quizzes.

  Model-view-controller

Explain Model-View-Controller paradigm

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Design a nested program

How many levels of nesting are there in this design?

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Write two short c programs and solve exam-style problem

Write two short C programs and solve four exam-style problems.

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd