Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Define a SCHEME function named make-clock which takes two parameters which represent the current time in hours and minutes. Your clock object should store
2. Define a SCHEME function named make-clock which takes two parameters which represent the current time in hours and minutes. Your clock object should store the current time in minutes only. Your clock object should ex pose three functions for working with the clock object 'tick- advances the time of the clock obiect by one minute 'time -returns a string with the current 12-hour time indicating whether the current time is AM or PM . 'military - returns a string representing the current time in military (24-hour) time >(define get-time (clock 'time)) >(define get-mil (clock 'military)) >(display (get-time)) ((clock 'tick)) >(display (get-time)) >((clock 'tick)) >(display (get-time)) >(display (get-mil)) 9:00 PM 9:01 PM 9:02 PM 21:02 2. Define a SCHEME function named make-clock which takes two parameters which represent the current time in hours and minutes. Your clock object should store the current time in minutes only. Your clock object should ex pose three functions for working with the clock object 'tick- advances the time of the clock obiect by one minute 'time -returns a string with the current 12-hour time indicating whether the current time is AM or PM . 'military - returns a string representing the current time in military (24-hour) time >(define get-time (clock 'time)) >(define get-mil (clock 'military)) >(display (get-time)) ((clock 'tick)) >(display (get-time)) >((clock 'tick)) >(display (get-time)) >(display (get-mil)) 9:00 PM 9:01 PM 9:02 PM 21:02
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started