Write a program to compute the monthly payment (M) on a loan given the loan amount (P), the annual percentage rate of interest (r), and the number of monthly payments (N). The program should allow the user to input P, r, and N, and would then compute and display M using the formula:
M = P * R * (1 + R)^N/((1 + R) ^N – 1)
Where R = r/1200, the monthly rate of interest expressed as a decimal.
Note that carat (^) means "raised to the power". Example t^4 means "t raised to the power 4."
2^4 = 2*2*2*2 = 16.
Your analysis should be clearly written and demonstrate your thought process and steps used to analyze the problem. Be sure to include what is the required output? What is the necessary input and how you will obtain the required output from the given input? Also, include your variable names, definitions and data types. Be sure to describe the necessary formulas and sample calculations that might be needed.
2. Using a similar approach as the example provided in section 2.2(textbook page 78) for “The Sale Price Program continued”, provide your program design for the program you analyzed for calculating monthly payment above. Be sure to describe the fundamental tasks needed to solve the problem so you can use a modular design. Provide pseudocode of your overall design that includes the Main module and the order of the module calls (see page 82 for an example). Finally, list all of your pseudocode for each module (See example 2.6 on page 83 as an example).
3. Using a similar approach as the example provided in section 2.3 (textbook page 86) add comments to your pseudocode (see example 2.8 on pages 87-88). Then, prepare at least 4 sets of input data (Test data) along with their expected output for testing your program. Your test data can be presented in the form of a table as follows (note: feel free to adapt to your design):
Example application test data:
Loan Amount (P) Annual Interest Rate (r) Number of monthly payments (N) Monthly interest rate (R) Expect output: Monthly payment (M)