The two major modifications are the instruction of pointers

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

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: EM13346955

Questions Cloud

Application development and programming : application development and programming languagesprogramming languages have evolved since the first generation
Note use visual basic 2010visual basicassignment1 nbsp : note use visual basic 2010visual basicassignment1 nbsp nbspticketsellerthis assignment will contain two 2 parts event
National securitynbsp please respond to the followingselect : national securitynbsp please respond to the followingselect any two of the four basic strategies used to preserve
1 consider that on a certain day 495 passengers want to fly : 1 consider that on a certain day 495 passengers want to fly from honolulu hnl to new york jfk 605 passengers want to
The two major modifications are the instruction of pointers : the two major modifications are the instruction of pointers and the calculation of mortgage interest rates.requirements
Write two short c programs and solve four exam-style : write two short c programs and solve four exam-style problems. details on the programs are as follows.program
Wal-mart company financial analysisthe company should be : wal-mart company financial analysisthe company should be traded on nasdaq or nyse. big us companies have data widely
Prepare a report of on state bank of india sbi after going : prepare a report of on state bank of india sbi after going through the harvard business school case study.task
Leadership resources effective leaders stay up to date on : leadership resources effective leaders stay up to date on leadership research and theory while taking a critical eye to

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  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

  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.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

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

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

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

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

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

  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.

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