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

  Write song playlist class-object-oriented design principles

Write a song playlist class in C++ called "PlayList" using object-oriented design principles. The playlist should support the following ADT.The implementation should be based on an array of strings to store the song titles.

  Create a text file named grades.txt

Write a program to calculate students' average test scores and their grades. Creat a text file named  grades.txt

  Create if-then statement with single alternative decision

Create the If-Then statement (or a flowchart with a single alternative decision structure) which assigns 20 to  variable y and allots 40 to variable z if variable x is greater that 100.

  Create a serial object s

The function call operator is overloaded and will generate a sequential integer each time the operator is used and the object can be created with the sequence start value specified.

  Show the deatils of an emplyoee - c programming

Show the deatils of an emplyoee in a neat format.

  Extend the definition of the class clocktype by overloading

a. Extend the definition of the class clockType by overloading the post-increment operator function as a member of the class clockType

  C program that compare the time required

Write a C program that compare the time required to compute the product of two 10,000 x 10,000 matrices with and without optimization for locality.

  During the execution of the above code, how many instru

(a) During the execution of the above code, how many instructions are executed? (b) Assuming a standard unicycle machine (CPI = 1) running at 100 KHz, how long will the above code take to complete?

  Array of integers declared-initialized to number of tickets

Array of integers named parkingTickets has been declared and initialized to number of parking tickets given out by city police each day as beginning of current year.

  Many bank atm machines have recently added the ability to

many bank atm machines have recently added the ability to dispense cash with- drawals in multiple bill denominations

  Each has a string for their name

Create a class in C++ that holds robot warriors. Each has a string for their name, a number of hitpoints (an float), armor (a defensive modifier(an int)), and weaponry (an offensive multiplier(another int)). You will create 5 robots with a random ..

  Implement the guess the word

Implement  the ‘Guess the Word' game in an object-oriented manner

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