Question: ************PLEASE USE THE SCHEME(RACKET) LANGUAGE. DO NOT USE JAVA!!!****** Define a SCHEME function named make-clock which takes two parameters which represent the current time in
************PLEASE USE THE SCHEME(RACKET) LANGUAGE. DO NOT USE JAVA!!!******
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 expose three functions for working with the clock object:
tick - advances the time of the clock object 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
Note: If the time is displayed in military time, your object should print any leading zeros for the hour. Both time formats should print leading zeroes for the minutes. For example:
>(define clock (make-clock 2 0)) >(define get-time (clock time)) >(define get-mil (clock military)) >(display (get-time))
>(get-mil) >((clock tick)) >(display (get-time)) >(display (get-mil)) 2:00 AM 02:00 2:01 AM 02:01
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
