10-02-2013 - LAB

posted Oct 2, 2013, 5:19 AM by Samuel Konstantinovich   [ updated Oct 2, 2013, 7:15 AM ]
At home you can send/get files that you save in the computer lab.  FileZilla is a program that allows you to connect from home to school. You can then send and receive files. This means you can go home, run FileZilla, get your lab, work on it, then send it back to school. 
This also means you don't have to email yourself the work at the end of class, or even save it to a flash drive.
There are many tutorials on FileZilla, you just need to know the address of the computer you are connecting to, and that was provided in a previous lecture.

Settings you need to know
Host: any of the lab computers in the same room you use (lisa's room)
user/pass your personal account
port: 22


Lab02Cond : 
Remember to name your file Lab02Cond.  Also put your name in the top of the file as a comment. 

LAB Directions:

1. Write a function weeklyPayCalc that calculates your weekly pay based on two parameters hours and wage. This function should account for overtime after 40 hours. Overtime means that any hours past 40 get 1.5x the pay.

(weeklyPayCalc hours wage)
examples:
(weeklyPayCalc 40 10) --> 400 (40 regular hours)

(weeklyPayCalc 42 10) --> 430 (40 regular hours + 2 overtime hours)
(weeklyPayCalc 53 10) --> 595 (40 regular hours + 13 overtime hours)

2. Write a function that determines how many roots a quadratic equation has as determined by the discriminant. Remember the discriminant is b*b-4*a*c.

Your function should return according to this table:
Discriminant    Roots
Negative           "No Real Roots"
0                       "One Root"
Positive            "Two Roots"

(rootsOfQuadratic a b c)
(rootsOfQuadratic 1 6 9) --> "One Root"
(rootsOfQuadratic 1 0 1) --> "No Real Roots"
(rootsOfQuadratic 1 0 -1) --> "Two Roots"

2b. Improve your roots function as follows:
When a discriminant is positive, it can be 2 rational or 2 irrational roots. When the discriminant is a perfect square, the roots are rational but when it is not a perfect square the roots are irrational. You can use either the (integer? x) function which is true when x is an integer, false otherwise, or (floor x) function which rounds a number down. (floor 2.3) -> 2 .0    (floor -3.5) -> -4.0

(rootsOfQuadratic 1 0 1) --> "No Real Roots"
(rootsOfQuadratic 1 0 -1) --> "Two Rational Roots"
(rootsOfQuadratic 1 3 1) --> "Two Irrational Roots"
(rootsOfQuadratic 1 0 1) --> "No Real Roots"

3. Come up with your own test cases for each problem (1 and 2b)
-You must use test cases that I did not provide to you.
-You must verify the test case outside of your program and see if it matches.
-Write a comment that explains your test cases next to each one.


Comments