Preliminaries
In this lab we will implement functions whose definition will include cond-expressions. Consider a function shippingweight which tests if a given shipping weight is in the interval [100, 500]. Assume we have written the following (faulty) function definition.
;; shippingweight : num -> string
;; purpose: checks if shipping weight w is in the interval [100,500], responding with a message
;;Examples: (shippingweight 50) should output "too little", (shippingweight 100) should output "about right",...
(define (shippingweight w)
(cond
[(<= w 500) "about right"]
[(< w 100) "too little"]
[else "too much"]))
To test this function, we should pick values for w from each of its categories and for boundary cases, for example: 50, 100, 200, 500, 600. So far we have written tests as function calls using test values and have checked the output value ourselves (e.g. (shippingweight 600) produces "too much"). We can rewrite these tests as claims using DrRacket's check-expect function:
(check-expect (shippingweight 40) "too little")
(check-expect (shippingweight 100) "about right")
(check-expect (shippingweight 200) "about right")
(check-expect (shippingweight 500) "about right")
(check-expect (shippingweight 600) "too much")
Notice how only 4 of these tests pass. The first one fails. Oops! for value 40, the condition of the first cond-clause is satisfied so we return "about right", when we actually wanted to output "too little". We can fix our function by swapping the first and second cond-clauses. This time our function passes its tests.
Part 1
The computations required for this lab are presented as a collection of formulas. Each can be transcribed into a corresponding Racket function. No formula requires anything other than standard straightforward arithmetic and logical operations.
Note: the following numerical method produces correct results only for dates in the twentieth and twenty-first centuries. (It can be modified to work with other centuries.)
We first define a function weekday which maps the integers 0 through 6 to the weekdays Saturday through Friday, as follows:
We then define a function leap? which determines whether a given year y is a leap year or not.
We then define adj. This is a function which computes an "adjustment" value based on a given month and year.
Implement functions weekday, leap? and adj. The calculation of the leap? function requires using DrRacket's modulo function.
The modulo function (denoted above by mod) determines the remainder of the division of the two numbers provided to it. To receive full credit, every function you write must be preceded
by a contract and purpose, and, furthermore, at least some test cases using check-expect must appear after each.
[Note: Functions in part 1 (weekday, leap? and adj) should be finished by the end of your lab session. You should also get started on part2. Turn in all your work at the end of the lab session according to these new submission instructions.]
Part 2
[Note: For receving check+ credit, you must start working on part 2 of the lab. You are not required to finish by the end of the lab session. You will have a chance to finish part 2 in this week's homework.]
We define dow, short for day of the week.

r above as straight brackets) determines the closest integer below a real number. The modulo function (denoted above by mod) determines the remainder of the division of the two numbers provided to it.Hand in your work
To receive full credit, you should complete part 1 and have made a good start on part 2 of the lab. As usual, part 2 of this lab will be included in this week's homework.
Submit all your work (on both parts of the lab) according to the new submission instructions.