I am new to racket (first year student) and since class has been pushed to 
online only, I am having a harder time.

We are currently working on vectors and hash tables. I feel like I keep 
overthinking it and keep getting stuck. I know that the first parameter in 
the function will be the year and the second will be the (vector-ref months 
x)that I pull from the defined vector.

The question I am having a hard time with and what I have actually done 
below.

Create a function that calculates the number of days in a month given a 
year and a month
   
   - Call the function number-of-days-in-month, and it's signature is 
   number, number -> number
   - Example:
   (number-days-in-month 2016 1) -> 31
   (number-days-in-month 2016 11) -> 30
   (number-days-in-month 2016 12) -> 31
   (number-days-in-month 1900 2) -> 28
   (number-days-in-month 2000 2) -> 29
   (number-days-in-month 2016 2) -> 29
   (number-days-in-month 2200 2) -> 28

*What I have so far...*

;Leap Year
(define (leap-year? year)
  (and (zero? (modulo year 4))
       (or (not (zero? (modulo year 100)))
          (zero? (modulo year 400))
          )
       )
  )

;Months with days vector, beginning at an index of 0 since there is not 0th 
month
(define months (vector 0 31 28 31 30 31 30 31 31 30 31 30 31))

(check-expect(number-days-in-month 2016 1)31)
(check-expect(number-days-in-month 2016 11)30)
(check-expect(number-days-in-month 2016 12)31)
(check-expect(number-days-in-month 1900 2)28)
(check-expect(number-days-in-month 2000 2)29)
(check-expect(number-days-in-month 2016 2)29)
(check-expect(number-days-in-month 2200 2)28)

*I  need help with building the actual function and what conditionals I 
should be using.*

(define (number-days-in month ?? ??)
    (cond
         [

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/5d017eef-b235-4a8b-94fa-fe1e3f7b766e%40googlegroups.com.

Reply via email to