### 2017-09-26 HW09

posted Sep 25, 2017, 3:40 PM by Samuel Konstantinovich   [ updated Sep 26, 2017, 6:40 AM ]
 ```SOLUTIONS TO Recent HW: (define (isBetween a b n) (or (and (> n a) (< n b)) (and (< n a) (> n b)))) ;alternate ; (and (> n (min a b)) (< n (max a b))))) ;alternate 2 which is similar to the 1st one````;but you were told not to use this ````; (or ; (< a n b) ; (> a n b)))) (define (xor a b) (and (or a b)(not (and a b)))) ;alternate: (not (equal? a b)))) ;this is not using boolean logic however``````;There are only 4 test cases: (xor #true #true) (xor #true #false) (xor #false #true) (xor #false #false) (define (alarmTime day isVacation) (if isVacation ;vacation (if (or (= day 0)(= day 6 )) 12 ;weekend 10);weekday ;not vacation (if (or (= day 0)(= day 6 )) 10 ;weekend 7)));weekday ;Sample test cases:``````(alarmTime 0 #true) (alarmTime 2 #true) ``````(define(gradeFix n) (cond ((>= n 90)n) ((> n 86)88) ((> n 82)85) (else 50))) ```Lab Should be doable in class!-place as a comment in the homework 9 slot when you finish-If not done in class finish at home. -These are much easier than the homework due Thursday.You have 6 functions to write (many do not use if/cond)If your code works for ONLY my test cases it is wrong. It must work as described, for all test cases. You must come up with your own test cases to convince yourself that it works. a) Write a function (or35 n) that accepts a non-negative integer and returns a boolean. -Return true if the given non-negative number is a multiple of 3 or a multiple of 5, false otherwise. (or35 6)  → #true(or35 10) → #true(or35 8)  → #falseb) Write a function (old35 n) that accepts a non-negative integer and returns a boolean. -Return true if the given non-negative number is a multiple of 3 or 5, but not both, false otherwise. (old35 6)  → #true(old35 10) → #true(old35 15) → #falsec) Write a function (more20 n) that accepts a non-negative integer and returns a boolean. -Return true if the given non-negative number is 1 or 2 more than a multiple of 20, false otherwise. (more20 20) → #false(more20 21) → #true(more20 22) → #trued) Write a function (less20 n) that accepts a non-negative integer and returns a boolean. -Return true if the given non-negative number is 1 or 2 less than a multiple of 20, false otherwise.(less20 18) → #true(less20 19) → #true(less20 20) → #false(less20 21) → #falseWrite a function (nearTen n) that accepts a non-negative integer and returns a boolean. -Given a non-negative number, return true if num is within 2 of a multiple of 10, false otherwise.(nearTen 12) → #true(nearTen 17) → #false(nearTen 19) → #trueWrite a function (categorize n) that accepts a non-negative integer and returns one of several categories:-> "strange"  when n is a multiple of 3 or 5 but not both. -> "charm"    when n is a multiple of both 3 and 5.-> "down"     when n is within 2 of a multiple of 10. This has lower priority than "strange" or "charm".-> "up"         for all other numbers.Do not re-write code that you have previously created. Use functions that you have previously defined.(categorize 15) → "charm"(categorize 20) → "strange"(categorize 30) → "charm"(categorize 19) → "down"(categorize 13) → "up"