CS 115 Lab 2 Practice with Math Operators

95 Points

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

INSTRUCTIONS:

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


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!
DescriptionInputs
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

  • In your prolog at the TOP of your .py file, include the names of all team members who are PRESENT at the lab (emails not needed). Also include the purpose, pre- and post-conditions for the program. Remember to give the types of each input and output value.

    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

    If you do not attend lab, you will NOT get the points for the Team Problem, even if your team does submit a solution!

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