2015-10-13 Lab05

posted Oct 13, 2015, 5:10 AM by Samuel Konstantinovich   [ updated Oct 13, 2015, 5:18 AM ]
Goal: Remainder and Booleans

Various Test miscelanery:
Emergency Absence:
-If you are absent on a test day, your parents must contact the school or send me an email. (please use konstans@stuycs.org)
-If you are absent on a test day, it makes sense to communicate with me before you return to school.
-If you are so ill that you cannot do so, that is a valid excuse, but you would have to document this with some medical note.
Planned Absence:
-If you know ahead of time you are going to miss an exam, you must speak to me as soon as possible. 
In all cases:
-I do not have to give you a make-up exam if you do not provide sufficient documentation, and I will only drop the lowest grade if you take all of the exams/quizzes.


Your next quiz/test will have more quotient/remainder operators on it to make sure that you learned from your mistakes!

(remainder a b)
(quotient a b)

Lab05 - 5 functions
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 3) → #true
(or35 10) → #true
(or35 8) → #false

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 3) → #true
(old35 10) → #true
(old35 15) → #false


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) → #true

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) → #false

Write 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) → #true
Comments