ECE 1021

HOMEWORK #1

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

(Extra Credit Problem added at end - note conditions regarding due date)

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 useful program using the very limited constructs you have already been exposed to.

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 are 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 purchases 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 give 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.

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

PROGRAM B - Newton's Method

Programming Problem #2.9 (p68)

This program provides a very useful tool that you can use in other work, both in this class and outside of it. To get the most utility, write your program so that the function you are trying to find the zeros for is defined in one place in your code.

Notice that to use Newton's method you need to know not only the function but also its derivative. But this requirement is relaxed if you can estimate the derivative of the function at a particular point from the function itself. With this in mind, use the information provided in Problem #2.12 in order to have the program estimate the function's derivative.

PROGRAM C - Mystery Algorithm (Extra Credit)

The complete pseudocode for one of the classic computational algorithms is available in the file 01c0soln.txt. Implement this algorithm as Program C of this assignment and try to determine the functional relationship between the input values and the output values. For instance, is the output value the natural logarithm of the input value?

The first person to properly submit their source code (meaning that file headers and e-mail subject lines are correct) and include the correct functional relationship in the program subtitle (where it presently says UNKNOWN in the pseudocode header) will receive ten points added to their grade. The second person will receive nine points and so on down the line.

The date and time that the file is received by the ECE-1021 grader's account will be used for determining the order of submissions.