2014-09-24 HW11

posted Sep 24, 2014, 4:53 AM by Samuel Konstantinovich   [ updated Sep 24, 2014, 6:08 AM ]
Today's Lab + HW11:  (anything not completed should be completed at home. EVERYTHING should be submitted as hw )

Write your functions, and a sufficient number of test cases to show that your function works.

1. Create a (myQuotient a b) function that does the same thing as  (quotient a b). You may use any tools EXCEPT for the existing quotient function. Assume a and b are integers. This means you don't have to test it on decimals.

2. Write a function called isTheNthPlaceEven? that accepts two parameters x and column. Assume x is an integer, and column is a positive integer. The function returns true when that column (1 for 1's, 2 for 10's, 3 for 100's place etc) of the number is even, false otherwise. 
examples:
(isTheNthPlaceEven 30325  3)  
 #f     (in languages other than beginning student you can use #f as false  and  #t as true)
(isTheNthPlaceEven 30325  2)   #t
(isTheNthPlaceEven 6666 1)  
 #f

3. Write a function (biconditional a b) takes Boolean inputs a, b and returns true if both have the same truth value, false otherwise. You may only use and,or,not  operations.
(Think about your test cases...)

4. (XOR3 a b c) takes Boolean inputs a, b, c and returns true if exactly one input is true, false otherwise.
examples:
(XOR3 #t #t #t #f
(XOR3 #t #f #t) → #f
(XOR3 #t #f #f) → #t
(XOR3 #f #t #f) → #t

Q: How many test cases are required to see if your XOR3 command is correct? 

All of your solutions and tests should be put into a single text file with your header. They must be submitted on the HW server by the end of the weekend. (Sept 28th 11:59pm)
Comments