UMBC CMSC104

Project 2 Due: 30 Oct

This project will calculate how long it will to pay off the balance on something like a credit card, car loan, or a mortgage.

Requirements Specfication

31 Oct Clarification

Each month, you must calculate the interest and subtract the payment:

balance = balance + (balance * rate / 100 / 12) - payment

It would be better if you converted the annual rate in to a monthly rate immediately after you have a valid rate:

monthly_rate = rate / 100 / 12; Then you can have: balance = balance + (balance * monthly_rate) - payment Updated requirements:
Your program must ensure the following is true by doing error checking:
The balance entered by the user MUST be greater than $0.00.
The interest rate entered by the user MUST be greater than 0% and less than 25%.
The payment entered by the user MUST be greater than $0.00.

  1. Ask the user for the beginning balance.
  2. Ask the user for the annual interest rate (expressed as a percentage).
  3. Ask the user for the payment.
  4. Calculate how long it will take for the balance to be paid off.
  5. Display the number of years and months it takes to pay it off.
  6. Display the amount of interest will have been paid.

Name the source code file: proj2.c

Submission

Email the source file (the .c file) to the TA at pras1@umbc.edu.

The subject of the email should be "CMSC104 Project 2". This must be an exact match for the TA to be able to filter the mail and put your work in the correct folder!

Example Output 1

In the following example, the program displays what is in Blue and the user types what is in Red.

Enter the balance:  10000.00

Enter the interest rate as a percentage (18% as 18): 18 Enter the monthly payment: 235.73 It will take 5 years and 8 months to pay off the balance. You will pay $6014.84 in interest.

Example Output 2

Enter the balance:  3976.93

Enter the interest rate as a percentage (18% as 18): 17 Enter the monthly payment: 100.00 It will take 4 years and 11 months to pay off the balance. You will pay $1914.35 in interest.

Program Header Comment Block

Use the following comment block at the beginning of your source code:

/* 
** Filename:       proj2.c
** Name:           Ima Student
** SSAN:           6789  
** Date:           3 Feb 2001
** Course:         CMSC-104 Section XXX 
** Description:    (Your psuedocode goes here.  Must be detailed)
**     Analysis:
**                 Input:
**                 Output:
**                 Formulas:
**                 Constraints:
**                 Assumptions:
**     Design:     (Psuedocode is here)
** Notes:          (As needed, such has how to compile)
*/
P.S. It must be your name and the last four digits of your SSAN! Make sure to include your section number.

Remember, when designing your psuedocode, try to write it like you were explaining it to your 10-year old brother or sister. There is several things here that are similiar to the notes in Lecture 11!


UMBC CMSC104 CSEE | CMSC104 |