#lang s-exp "../lang/wescheme.rkt"
(provide make-auto
auto?
auto-model
auto-hp
auto-rims
auto-color
auto-cost
car1
paint-job
turbo-charge
draw-auto)
(define-struct auto (model hp rims color cost))
(define car1 (make-auto "M5" 480 22 "black" 50000))
(define (paint-job a color)
(make-auto (auto-model a)
(auto-hp a)
(auto-rims a)
color
(auto-cost a)))
(define (turbo-charge a)
(make-auto (auto-model a)
(+ (auto-hp a) 20)
(auto-rims a)
(auto-color a)
(auto-cost a)))
(EXAMPLE (paint-job car1 "purple") (make-auto "M5" 480 22 "purple" 50000))
(define (draw-auto a)
(place-image (rectangle 130 50 "solid" (auto-color a))
130 50
(place-image (circle (auto-rims a) "solid" "silver")
210 110
(place-image (circle (auto-rims a) "solid" "silver")
90 110
(place-image (circle 30 "solid" "black")
210 110
(place-image (circle 30 "solid" "black")
90 110
(place-image (rectangle 220 60 "solid" (auto-color a))
150 90
(empty-scene 300 150))))))))