//========================================================================= #define PROGRAMMER "SOLUTIONS, NoFrills" #define PROG_CODE "soln" #define COURSE "ECE-1021" #define YEAR (2003) #define TERM "Fall" #define SECTION (0) #define ASSIGNMENT "HW #1A" #define REVISION (0) #define TITLE "How much did that REALLY cost" #define SUBTITLE "" #define EMAIL "ece1021@eas.uccs.edu" #define FILENAME "01a0soln.txt" //========================================================================= 1) TASK: Get necessary data from user. 1.1) TASK: Prompt for and get Price 1.2) TASK: Prompt for and get AnnualRate 1.3) TASK: Prompt for and get FractionalMin 1.4) TASK: Prompt for and get AbsoluteMin 2) TASK: Generate Monthly Statements until paid off 2.1) TASK: Print Column Headings. (all on same line) 2.1.1) PUT: "Month" 2.1.2) PUT: "Opening" 2.1.3) PUT: "Payment" 2.1.4) PUT: "Finance" 2.1.5) PUT: "Closing" 2.1.6) PUT: "Due" 2.2) TASK: Initialize necessary variables. 2.2.1) SET: Month = 0 2.2.2) SET: CloseBalance = Price 2.2.3) SET: MinDue = 0 2.2.4) SET: TotalCost = 0 2.3) WHILE: (balance > 0) 2.3.1) TASK: Calculate Monthly Statement values 2.3.1.1) SET: Month = Month + 1 2.3.1.2) SET: OpenBalance = CloseBalance 2.3.1.3) SET: FinCharge = OpenBalance*AnnualRate*(1/12) 2.3.1.4) SET: Payment = MinDue 2.3.1.5) SET: CloseBalance = OpenBalance+FinCharge-Payment 2.3.1.6) TASK: Compute Minimum Payment for next month 2.3.1.6.1) SET: MinDue = ClosingBalance*FractionalMin 2.3.1.6.2) IF: (MinDue < AbsoluteMin) 2.3.1.6.2.1) SET: MinDue = AbsoluteMin 2.3.1.6.3) IF: (MinDue > CloseBalance) 2.3.1.6.3.1) SET: MinDue = CloseBalance 2.3.2) TASK: Print Monthly Statement values. 2.3.2.1) PUT: Month 2.3.2.2) PUT: OpenBalance 2.3.2.3) PUT: Payment 2.3.2.4) PUT: FinCharge 2.3.2.5) PUT: CloseBalance 2.3.2.6) PUT: MinDue 2.3.3) TASK: Update necessary variables 2.3.3.1) SET: TotalCost = TotalCost + Payment 3) TASK: Print Summary Information 3.1) PUT: "Purchase Price = " Price 3.2) PUT: "Months to pay off = " Month 3.3) PUT: "Total Finance Charges = " TotalCost - Price 3.4) PUT: "Total Cost of Purchase = " TotalCost