Due Date: Monday Februay 8 by the end of the lab session

Submit the program you write with the Canvas link on the assignment.

__Educational goals of this lab - verify that every student can__

- work with their team
- write an algebraic formula in correct Python syntax
- use input and output statements correctly
- use test cases to test a program

__INSTRUCTIONS:__

(10 points) **Team Problem #1: ** Get to know your team

- Everyone on the same team should be in the same breakout room. You will be working together. Exchange email addresses so that you can communicate with your team outside of lab. One member emails your TA with a list of the students on your team and their email addresses. Make sure to include which Team number (1-7) you are!

**Description of the problem:**

You are taking out a loan (principal) of a given amount, at a certain annual interest rate. You are going to be making monthly payments for a given number of years. Calculate what the payment will be, assuming it stays the same for each payment (called a "fixed payment").

This came from the web site: http://www.vertex42.com/ExcelArticles/amortization-calculation.html

(30 points) **Team Problem #2: ** Test Cases (work these out FIRST!, before class if possible)

Create a multi-line comment at the bottom of your program file which contains the answers that go in the blanks below. It should be the expected output from the program described below, the payment, given the inputs in the case. Use a calculator as needed. Here is a online calculator that you can use. You get 15 points for calculating them, 15 points when your program runs and gives the correct answers.

For answer E, give the reason it is an error (you won't have numeric answers for it). Look at the formula, it is dividing by zero. Actually substitute the input into the denominator and show how that is zero. You do NOT NOT want to give the Python error here! You are doing these BEFORE the program is written!

Description | Inputs Principal Number of Years Interest Rate per Year (APR) | Expected Output Payment |
---|---|---|

Normal cases | ||

Normal case with positive floats for principal and interest rate | 220., 3, 20.5 | ____A.____ |

Normal case with positive ints for all inputs | 15000, 4, 10 | ____B.____ |

Boundary cases | ||

Very large number for principal normal numbers for rate and years | 1e9, 5, 10 | ____C.____ |

All inputs are 1 | 1, 1, 1 | ____D.____ |

Error case | ||

All inputs are 0 | 0, 0, 0 | ____E.____ |

Remember these answers, A-E, are in a multi-line comment at the bottom of the team .py file.

(15 points) **Team Problem #3:** Design

Paste this design into your .py file and complete the last 2 steps.

#1. Print title #2. Get inputs from user (principal, number years, interest rate) #3. Convert rate to percent and to monthly rate #4. Convert years to months #5. what? (5 points) #6. what? (5 points)

(40 points) **Team Problem #4: ** Implementation

- Write a program that use the design in problem #3 to tell if you take out a loan of a certain amount, for so many years, with a certain interest rate per year, what the payment amount will be.
- You MUST have a main function definition (def main():) and a call to main (main()) at the bottom.
- Put spaces around your operators - makes them MUCH easier to read! Both the assignment operator (=) and the math operators.
- The design should be interlaced with the code, NOT in the prolog!
- Variable names MUST have more than one character. The reason the formula is given with single letters is that mathematicians have to write the formula by hand and the single letters makes it easier. You are typing your identifiers, so you have time to make them a bit longer. Don't use "n", use "months".
- The first number input is the loan amount (principal) (float), The second number input is the number of years the loan is for (int), The last number input is the interest rate per year (float).
- The user should be allowed to input the interest rate as a percent rate per year, annual interest rate. This input number needs to be converted to a percent (divide by 100) AND converted to a monthly rate (divide by 12).
- The number of years needs to be converted to the equivalent number of months. There are 12 months in a year.
- Then use the formula given above to find the payment amount.
- Display the payment with only two decimal places, using the .format metho.
Note that the $ in the test cases is
**right next to**the payment amount. - Test case 1
Payment Calculator Enter initial amount of loan: 25000 Number of years to pay back loan: 30 Interest rate per year (%): 3.25 Payment is $108.80

For this test case, the principal is 25000, the number of months is 30 * 12 (to make months from years), the interest rate is 3.25 divided by 100 (for percent) and then divided by 12 (for months).

- Test case 2
Payment Calculator Enter initial amount of loan: 200000 Number of years to pay back loan: 15 Interest rate per year (%): 6 Payment is $1687.71

- Make sure to run your test cases from above to see that you are getting the right answers.
- Make sure that all members of the team
**understand**the team result. - Submit with the Canvas link.

Make sure you save your programs somewhere as a backup to the copy on Canvas! Teams forget to submit sometimes!