Student Name: Class/Section: CMIS 102 Professor Name: Dr. Hung Dao Assignment due date: 5/27/2012
Problem definition: Calculate the monthly payment on a loan given the loan amount, the annual interest rate, and the total number of monthly payments.
A. Problem Analysis – Here are the input data, output data and processing step to convert input data into output data. 1. Input Data: a. Loan Amount (P) b. Annual percentage rate of interest (r) c. Number of monthly payments (N). 2. Output data: Monthly Payment (M) 3. Processing: The output M can be obtained from the input data by using the following formula: M = P * R* (1+R)^N/((1+R) ^N-1) where R =r/1200 B. Program Design – The program will consist of the following modules: Main Module Input Data Module (sub-module) Perform Calculations Module (sub-module) Output Data Module (sub-module) Main module Write “This program will compute the monthly payment based on the loan amount, the annual percentage rate of interest, and the number of monthly payments.” Declare P As Float Declare r As Float Declare N As Integer Declare M As Float Call Input Data Module Call Perform Calculations Module Call Output Data Module End Program
Input Data module Write “Please enter the loan amount: ” Input P Write “Please enter the annual percentage rate of interest: ” Input r Write “Please enter number of monthly payments: ” Input N Perform Calculations module Declare R As Float Set R = r / 1200 Set M = P * R * (1 + R)^ N / ((1 + R) ^ N – 1) Output Data module Write “The loan amount is: “ + P Write “The annual interest rate is: “ + r Write “The number of monthly payment is: “ + N Write “The monthly payment amount will be: “ + M B. Program Comments and Test Data – Input: loan amount (P), annual interest rate ( r), number of monthly payments (N) P = 10,000 r = 5% N = 60 P = 30,000 r = 4% N = 60 P = 200,000 r = 3.75% N = 360 926.23 552.50 Expected output: Monthly Payment (M)