Question: 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
Get step-by-step solutions from verified subject matter experts
