;; Problem: We have interns, who work at an hourly rate, and ;; full-time employees, who are salaried. We need to keep track ;; of these employees, and print out their paychecks once a ;; month: "Pay to the order of Matthias Felleisen, $15,000." (define-struct intern (name wage/hr hours/wk)) (define-struct fulltime (name salary)) ;; An Employee is one of: ;; - (make-intern String Number Number) ;; - (make-fulltime String Number) ;; interp: ;; A (make-intern n w h) is an intern record where n is the name, ;; w is the hourly wage, and h is the hours worked per week. ;; A (make-fulltime n s) is a fulltime employee record where ;; n is the name and s is the monthly salary. #;(define (emp-template an-emp) (cond [(intern? an-emp) ... (intern-name an-emp) ... (intern-wage/hr an-emp) ... (intern-hours/wk an-emp) ...] [(fulltime? an-emp) ... (fulltime-name an-emp) ... (fulltime-salary an-emp) ...])) ;; print-paycheck : Employee -> String ;; Given an employee record, produce their monthly paycheck (define (print-paycheck emp) ...) ;; examples (define e1 (make-intern "Rachel Bakish" 10 20)) (define e2 (make-fulltime "Matthias Felleisen" 15000)) ;; (print-paycheck e1) --> ;; "Pay to the order of Rachel Bakish, $800." ;; (print-paycheck e2) --> ;; "Pay to the order of Matthias Felleisen, $15,000."