say 'Please enter a time when you want to make a reservation for tomorrow (HHMM).' do until res="" parse pull res call checknum call checktime say "Thank you. You've made a reservation for tomorrow at:" hours || ":" || min"." /* feedback if succsessful reservation */ call lineout "reservations.txt", "Reservation made:" date() "For next day at" hours || ":" || min"." /* saves time to reservation.txt */ end checknum: select when length(res) = 4 & datatype(res) = num then return /* checks if input is 4 digits long and if input is a number*/ otherwise say "That is an invalid input."; exit /* if invalid input, exit programm */ end checktime: parse var res 1 hours 3 min /* slices input into hours and minutes */ select when hours < 0 | hours > 24 then say "That is an invalid input." /* if hours is impossible time then exit */ when min < 0 | min > 59 then say "That is an invalid input." /* if min is impossible time then exit */ when hours < 8 | hours > 22 then say "The restaurant is closed at that time." /* if input is outside of opening hours then exit */ otherwise return end