Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

complete task 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 by DR RACKET BEGINING STUDENT PLEASE DO NOT KNOW DONT ANSWER AND ADD COMMENT PLEASE IF YOU ANSWER TRUE THEN I VOTE

complete task 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 by DR RACKET BEGINING STUDENT PLEASE DO NOT KNOW DONT ANSWER AND ADD COMMENT PLEASE IF YOU ANSWER TRUE THEN I VOTE YOU!
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
tratficlightTimer (1)rkt - DiRacket File Edit. View Language Racket Inseit Scripts Tabs. Help trafficlightimer (1)rkt * (define ) ) 1: traffictightTimenrkt 2: tratficlight Timer (1) rikt ; visual constants (define R 50) (define W(12R)) (define D. ( (28) (define ES (empty-scene W D)) (detine FRAVE (rectangle W D "outline" "black")) (define REDL (place-image foverlay/xy (overlay/xy toverlay/xy fRANE 0(2 R) (circle R "solid" "red")) 0.0 (circle R "outline" "yellow") ) 0 (* 2 R) (Circle p "outline" ngreen")) (/ W, 2) (/ D 2) ES)) (define Yel.tonL iplace-image (overlay/xy foverlay/xy (overlay/xy Frowe 0. (* - 2. R) (eircle. R "outiine" "red")) 0 o (circle R " solld" "yellow") 0 (* 2 R) (circle R "outline" "green") ) (f:2) ( ( D - 2) ES) ) (detine Grecat iplace-image Coverlay/xy foverlay/xy (overlay/xy Fruve 0(2a) (cirele 8 "outline* red*)) 0 o (circle R "outline" *yellow") ATrattictight TZ. "tea" "Yeltav" (decine-struict int ulight Timet) 2ThBK-4) Write contract and faut thore nxamples: j Contract: telek-t: FASK-4) Write contract and four more examples: ; Contract: tick-f: 2. Purpose: Check the timer of NIL. If it is equal to 0, change the light, otharwise subtract one trom counter Red Green Green Yellow 2. Ye11ow Red 2 Example: (check-expect (tick-f (make-NTL. "red" 0)) (make-NrL, "green" GT)) (check-expect (tick-f (make-NrL "red" 4)) (make-NrL "red" 3)) 77.sK-51 *irite tenplate: ATASK-6) Write tick-f function (needs change-light function): :TASK-7) rite contract and four more exaaplest; : Contract: change-light: 7. Puppose: change the 1ight and produce a new traftic light (eheck-expect (ehange-light "red") (make-krL "green" Gr)) FTAUK-2) Write cenplate: 2thap-9) 8rite change-1ight function: Trithiclightimes (1) rat- Drhacket Flle Edit View Lariguage Racicet Insert Sctipts Iabo Help traticlight Titwer \{1) \#Contract- drask-t d) Pipose: to dray;tho cuksent trafflo light : (define (drak-t, ant) fichi) :TASK-111, Ktita terplate. 27hake 12) wyitr draw of foncti bni Concract: pejici-ofticer: Putpote; to chatye th-11ght according to key event: ; MASK-12) Write draw-f function: : keyEvent is one of: : nIn i=ng : sin1ym :- a11 other keyevents (7ASK-13) Write contract and more examples: ; Contract: police-officer: ; Purpose: to change the light according to key event. : if keyEvent is i "red" ; if KeyEvent is 9 "green" : if Keybvent is y "yeilow" (check-expect (police-officer (make-NTL "redm 4) "z") (make-kTL "red" RT) ) :TASk-14) Write template: (7ASK-1.5) Write police-offices function: FNTL (mages (define (main init) (big-bang init fon-tick tick-f) (on-draw draw-f) (on-key police-orficer)) ) (main (make-NrL "yellow" 3 ))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

4. Identify the challenges facing todays organizations

Answered: 1 week ago