Develop a program that calculates monthly payments for loan

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

Further basics of C++ programming

Purpose: This homework involves some further basics of C++ programming, specifically loops. You will also get to work with random numbers again, which are important in formulating solutions to a multitude of problems in the scientific community and elsewhere (see the motivation for the introduction of random number generation in the last homework assignment (i.e., HW2)).

Instructions: The instructions are similar to previous homework's: This is an individual, not collaborative assignment; remember to be careful with naming rules; etc. See the HW 1 or HW2 descriptions for more details. Problem A: Tossing a Fair DieWrite a C++ program that simulates tossing a fair six-sided die. Your program should do the following:

1. Ask the user to input a random seed (of type int), and call srand with thenumber that is input as its argument. Thus, right after the variable declarations inyour program, you should have the lines:

cout << "Input the random seed: ";

cin >> seed;

srand(seed);

2.Use the cstdlib function rand() to generate a random number between 1 and 6.

Note that the number 1 corresponds to one dot on the side of a die; the number 2 corresponds to two dots on the side of a die, and so on for the numbers 2, 3, 4, 5, and 6, where each number represents the number of dots on the side of a six-sided die. All possibilities (one dot through six dots) should be equally likely to occur when a die is rolled. Repeat this process 100 times, and keep a count of the number of times each dot occurs when the die is rolled.

3. Repeat Step 2 (i.e., generate another 100 random numbers) and count the number of times each number of dots surfaces on the die.

4. Print out the results, that is, the counts for each time each side of the die was rolled, and the average value for the 100 rolls of the die for each set.

5. Continue until the program user chooses to exit by inputting a character other than ‘y'

Below is an example run of the program.

Input the random seed: 35

First SetSecond Set

one1816

two1113

three2113

four2525

five1321

six1212

Set 1 Avg.Set 2 Avg.

3.43.58

Would you like to continue (Enter y or n): y

First SetSecond Set

one2210

two1220

three1725

four1319

five166

six2020

Set 1 Avg.Set 2 Avg.

3.493.51

Would you like to continue? (Enter y or n): n Be sure to include a continuation loop in your program (as indicated in step 5 above and demonstrated in the example above). Hint: The switch statement might be helpful in formulating your program.

Problem B: Home Loan Amortization Develop and test a program that calculates the monthly payments for a loan amount and a term (number of years) input by the user. Once the loan amount and term are obtained from the user, the program should compute and display the monthly payment for a range of interest rates from 3% to 18%. The formula for determining this is A/D, where A is the original loan amount (the loan amount entered by the user) and D is the discount factor. The discount factor is calculated as follows:

D = ((1 + r)n-1) / r(1 + r)n

Where n is the total number of payments (assume that one payment is made each month, and thus n is equal to 12 times the number of years of the loan), and r is the interest rate expressed in decimal form (e.g., 0.05 for a 5% interest rate) divided by 12.

A monthly payment table should be generated as shown in the outline of an example run below:

Enter Loan Amount: 350000

Enter Term for Loan (in Years): 30

Interest RateMonthly Payment

3% 1475.61

4% 1670.95

5% 1878.88

6% 2098.43

..

. .

. .

18% 5274.80

Would you like to continue? (Enter y or n): n Note that your program should include a continuation loop that will enable to the user to enter a new loan amount and new term and generate a new table based on the new amount and term without exiting the program (in a manner similar to Problem A) Test your program a variety of times to make sure its answers are correct. You can check your results with an online mortgage calculator.

Reference no: EM13974101

Questions Cloud

What does this exercise tell you about the nature of memory : Now ask a friend or family member who was present at the time to write a description of the same event [or you can call and ask them about it on the phone, unless you use email to correspond with your friends/family]. Do your accounts differ? If s..
John claim for taxes on return : Real estate taxes: $3,200 State income tax: $3,400 Special assessment for installation of sidewalks: $1,140 Penalty on tax underpayment: $300 Flat fee for automobile registration: $90 What itemized deduction may John claim for taxes on his return?
Research this incident using quality and reputable resources : Determine whether the software issue, which caused inaccurate evidence in the trial, would've affected your perception of the prosecution's case if you were a juror in this trial.
Internal rate of return of an investment : Using the tables above, what would be the internal rate of return of an investment of $210,600 that would generate an annual cash inflow of $50,000 for the next 5 years?
Develop a program that calculates monthly payments for loan : Home Loan Amortization Develop and test a program that calculates the monthly payments for a loan amount and a term (number of years) input by the user.
Evaluate available psychological tests : How should counselors evaluate available psychological tests and other assessments before they administer them to their clients
Consider the data given in the following table and identify : Consider the data given in the following table and identify the appropriate category for item C in an ABC classification.
Two alternatives and make a recommendation : a. Use NPV techniques to analyze these two alternatives and make a recommendation. The BTRR (interest rate) is 12%. b. Use IRR techniques to analyze these two alternatives and make recommendations.
Describe digital forensics and process management. : Consider that Data Security and Policy Assurance methods are important to the overall success of IT and Corporate data security.

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