ECE-1021

HOMEWORK #5

(Last Mod: 27 November 2010 21:38:42 )

ECE-1021 Home


PROGRAM A - How much did that really cost?

People use - and abuse - credit on a daily basis. The purpose of this homework assignment is to permit you to develop a program that does not involve very complex logic but that none-the-less permits you to explore the issue of credit abuse. You may discover some harsh, but very useful, lessons about your own use of credit in the process.

When it comes to credit, there are a number of interesting and informative questions that can be asked. For instance, say you purchase an item on a revolving credit account (e.g., a credit card). Most people do this all the time without giving it much thought - but they might give it a thought if they knew how much they were truly going to pay for that item by the time they pay it off, especially if they only make the minimum payments.

The repayment terms for most credit cards follow a common plan - and we will assume that our dredit card uses this plan except with perhaps different numbers. The basic plan is as follows:

Your minimum payment is either a specific fraction of the new balance (typically between 2% and 3%) but not less than some absolute minimum (typically between $10 and $20) or the remaining balance if it is less than the absolute minimum. Your new balance is simply the old balance plus any new purchases minus any payments plus the finance charges. For our purposes, we will assume that there are no new purchases (since we want to find out how much a specific purchase is going to cost us) and  that the payment is made as late as possible (a pretty good assumption in the case of many people). Therefore the new balance (upon which the minimum payment is calculated) is the old balance, plus one month's interest on that balance, minus the previous month's payment.

Your program should print a month-by-month table that gives the month number and the basic information that would be on the statement for that month, namely the old balance, the finance charges, the payment credited, the new balance, and the minimum payment due.

Once the item is paid off, you should print a summary that gives the following information:

The original purchase amount, the total number of months required to pay of the purchase, the total amount of the finance charges, and the total cost of the purchased item.

Do NOT hardcode any of the information that might vary from one credit card to another and do not hard code the purchase amount. One of the first tasks your program should perform is to ask the user for the relevant information, namely the purchase price, interest rate, minimum payment percentage, and minimum absolute payment.

Using your program, see how much the following item would end up costing you:

PROGRAM B - How much did that really cost - modular?

Modularize your above program by writing simple, well-defined functions that are then called by the higher level code. For instance, you should have a function that generates the payment table. As part of that, you should have a function that generates a single line in the payment table. As part of that, you should have functions that compute certain elements of the table such as the minimum payment. Your pseudocode should reflect the nature of the modularization you plan to implement.