11-20-2013 HW HW HW!

posted Nov 19, 2013, 10:00 PM by Samuel Konstantinovich   [ updated Nov 19, 2013, 10:58 PM ]
Goal: Work while Mr. K has jury duty. 

DO NOW:
I:
1. Open the homework server and log in to your "view homework" page.
2. Click on your '2nd Scheme HW'
3. Run DrRacket
4. Switch to PrettyBig
5. Paste your code into it.
6. NOW paste THIS code after your code:

(newline)
(display 1999)(display (leapyear 1999))
(newline)
(display 2003)(display (leapyear 2003))
(newline)
(display 2100)(display (leapyear 2100))
(newline)
(display 2000)(display  (leapyear 2000))
(newline)
(display 2004)(display (leapyear 2004))
(newline)
(display "12AM=")(militaryTime 12 "AM")
(display "12PM=")(militaryTime 12 "PM")
(display "1AM=")(militaryTime 1 "AM")
(display "1PM=")(militaryTime 1 "PM")
(display
(+
(if (equal? #f (leapyear 1999)) 1 0)
(if (equal? #f (leapyear 2003)) 1 0)
(if (equal? #f (leapyear 2100)) 1 0)
(if (equal? #t (leapyear 2000)) 1 0)
(if (equal? #t (leapyear 2004)) 1 0)
(if (equal? (militaryTime 12 "AM") 0) 1 0)
(if (equal? (militaryTime 12 "PM") 12) 1 0)
(if (equal? (militaryTime 1 "AM") 1) 1 0)
(if (equal? (militaryTime 1 "PM") 13) 1 0)
))
(display " of 9")
(newline)


7. Run the code. If your score is 8 of 9, or 9 of 9 then you are awesome. 
If your score is 5 or less, OR doesn't even print a number, then you are less awesome. (But probably awesome in some way.)



II: Repeat this process for the 'FINAL SCHEME HW', but use the test code below:

(newline)(display (sumSquareAtoB 1 3))
(newline)(display (sumSquareAtoB 4 5))
(newline)(display (sumSquareAtoB 1 10))
(newline)
(newline)(display (sumSquaresList '() ) )
(newline)(display (sumSquaresList '(3 1) ) )
(newline)(display (sumSquaresList '(1 2 3) ) )
(newline)
(newline)(display (sumSquaresSubList '( ()  ()   (   ( )  )  ) ) )
(newline)(display (sumSquaresSubList '( (1 2)  ()   (   (3 )  )  ) ))
(newline)(display (sumSquaresSubList '( (1 2)  (4)   (   (3 ) 5 )  ) ))
(newline)
(newline)(display (prime? 4))
(newline)(display (prime? 15))
(newline)(display (prime? 21))
(newline)(display (prime? 2))
(newline)(display (prime? 7))
(newline)(display (prime? 23))
(newline)
(newline)
(display (+
 (if (= (sumSquareAtoB 1 3) 14  ) 1 0)
 (if (= (sumSquareAtoB 4 5) 41   ) 1 0)
 (if (= (sumSquareAtoB 1 10)385   ) 1 0)
 (if (= (sumSquaresList '() )0   ) 1 0)
 (if (= (sumSquaresList '(3 1) )  10   ) 1 0)
 (if (=  (sumSquaresList '(1 2 3) ) 14  ) 1 0)
 (if (=  (sumSquaresSubList '( ()  ()   (   ( )  )  ) ) 0  ) 1 0)
 (if (=  (sumSquaresSubList '( (1 2)  ()   (   (3 )  )  ) ) 14  ) 1 0)
 (if (=  (sumSquaresSubList '( (1 2)  (4)   (   (3 ) 5 )  ) ) 55  ) 1 0)
 
(if (equal? (prime? 4)  #f ) 1 0)
(if (equal? (prime? 15)   #f ) 1 0)
(if (equal? (prime? 21)  #f ) 1 0)
(if (equal? (prime? 2)  #t ) 1 0)
(if (equal? (prime? 7)  #t ) 1 0)
(if (equal?  (prime? 23) #t ) 1 0)
))
(display " of 15 points + (10 more based on hail and hanoi below):")
(newline)
(newline)
(printHail 3)
(newline)
(hanoi 4 "A" "B" "C")

You must re-submit your final scheme assignment (there is a new slot for this, do not erase the old one)
You must not have any (display) statements EXCEPT for inside of your hanoi + printHail
You MUST have the same EXACT spelling as the original assignment... Which is the spelling in the test.
Work on this in class, and at home tonight. Submit before 8am tomorrow. 

If you didn't submit it before, you have a 0, but can recover some points. (Be thankful)
If you submitted it before, and it doesn't work, then you can recover MANY MORE!
Some of you have very little work to do. Some of you have a lot of work to do. 

Comments