Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use modular programming principles (as discussed in section 3.2 of the Prelude t

ID: 3727096 • Letter: U

Question

Use modular programming principles (as discussed in section 3.2 of the Prelude to Programming book) to develop a program using pseudo code statements to answer the problem below. Answer each of the following areas:
o Design a hierarchy chart to document the program in a modular fashion.
o Design this program in a modular fashion using pseudo code (e.g. INPUT, SET, WRITE); each module should use as a series of sequence control structures.
Use Microsoft Word to complete this part.

Sara wants to buy a car. Help Sara compute the monthly payment on a loan. You have the following data:

1. You will be given the loan amount, the annual percentage rate of interest, and number of monthly payments.

2. Your program should allow Sara to input the loan amount, interest rate, and how many payments she wants to make.

3. Your program should then compute and display the monthly payment.

4. You need to make the following variables: Payment, LoanAmt, InterestRate, MonthlyRate, NumberMonths.

5. You will need the following formula: MonthlyRate = InteresteRate/1200

6. When the user enters InterestRate as a percentage, it must be divided by 100 to make it a decimal (i.e., 18% = 18/100 = 0.18).

7. The InterestRate offered by car dealers is an annual rate so this must be divided by 12 to get the MonthlyRate.

8. The formula in step 5 combines steps 6 and 7 (i.e., annual rate of 18% = 18/100 =0.18 and the monthly rate is 0.18/12=0.015 or 18/(100*12) = 18/1200.)

9. Payment = LoanAmt * MonthlyRate * (1 + MonthlyRate)^NumberMonths / ((1+MonthlyRate)^NumberMonths – 1)

10. This formula must be entered correctly for it to calculate the correct answer.

Explanation / Answer

The required program in a modular fashion using pseudo code (e.g. INPUT, SET, WRITE) is given below:

/*NOTE: If you want in a different way, please let me know through comments; I will surely revert back to you.*/

Input: LoanAmt, InterestRate, NumberMonths

Calculate: MonthlyRate, Payment

Output: Payment

Declare Payment as Float

Declare LoanAmt as Float

Declare InterestRate as Float

Declare MonthlyRate as Float

Declare NumberMonths as Integer

Write “Please enter loan amount”

Input LoanAmt

Write “Please enter number of months for payments”

Input NumberMonths

Write “Please enter Interest rate”

Input MonthlyRate

Set MonthlyRate=MonthlyRate/1200

Set Payment = LoanAmt*MonthlyRate*(1+MonthlyRate)^NumberMonths/((1 + MonthlyRate)^NumberMonths–1)

Write “The monthly payment on this loan will be: “ + Payments

/*Hope this helps. Thanks.*/