Submission Locations:
- email deugo@scs.carleton.ca with answer file as an attachment.
- my mailbox in The School of Computer Science main office - 5302 Herzberg Building.
- give to me during your demo on Monday, Dec 17.
Submission File Formats:
- Word
- RTF
- text
- HTML
Make sure you include the following:
- Name:
- Student #
- Students with an even last digit (0,2,4,6,8) in their student numbers should answer 5 out of 6 questions marked EVEN. Students with an odd (1,3,5,7,9) last digit in their student numbers should answer 5 out of 6 questions marked ODD.
- You get to choose which 5 questions out of 6 you answer.
- Ottawa University students use your Ottawa University student number, Carleton University students use your Carleton University student number.
- Answer questions within the specified word limits. However, be direct and to the point. Remember less is often better.
- Please be as neat as possible. If I can’t read it, I can’t give you credit for it.
- Feel free to use point form instead of prose (it's easier to understand and uses less words) and, use examples/diagrams if you feel they are required.
- Your answers should be your own. You are not permitted to work in groups on this exam.
- If you have questions, send me an email
(define (createMoney x1 x2)
(let ( (dollars x1) (cents x2) (self 1) )
(define (getAmount) (+ ( * dollars 100) cents))
(define (print) (list "$" dollars "." cents))
(define (lessThan? aMoney) ( < (getAmount) ((aMoney
'getAmount))))
(define (min aMoney)
***
(if (lessThan? aMoney)
self
aMoney))
(define (dispatch operation)
(cond
((equal? operation 'getAmount) getAmount)
((equal? operation 'print) print)
((equal? operation 'lessThan?) lessThan?)
((equal? operation 'min) min)
(else (error "wrong function call"))))
(set! self dispatch)
self))
(define m1 (createMoney 10 50))
(define m2 (createMoney 50 10))
(define m3 ((m1 ‘min) m2))
(define m1 (createMoney 10 50))
(define m2 (createMoney 50 10))
(define m3 ((m1 ‘min) m2))