dim as double start_timer, stop_timer, minutes, seconds dim as double count_minutes,count_seconds,time_limit dim as double remaining_minutes,remaining_seconds print "Press the t key to start the timer and stopwatch or s for the stopwatch only." prompt: print "Stopwatch ready>" while choice$ <> "t" choice$=inkey$ if choice$="s" then 'In this case, we don't want a timer.' print "Starting stopwatch with no timer." 'make sure the stopwatch starts over' print "Press the s key to stop the stopwatch." goto stopwatch_only end if wend input "How many minutes to set the timer for:",count_minutes input "How many seconds?:",count_seconds time_limit=(count_minutes*60)+count_seconds print "Press the spacebar to see how long the stopwatch has been running." print "Press r to see the time remaining on the timer." print "counting." start_timer=timer print "Press the s key to stop the stopwatch." choice$="" while a$ <> "s" stop_timer=timer a$=inkey$ if stop_timer-start_timer < 60 then seconds=stop_timer-start_timer else minutes=(stop_timer-start_timer)/60 seconds=(stop_timer-start_timer) mod 60 end if remaining_time=time_limit-(stop_timer-start_timer) remaining_minutes=remaining_time/60 remaining_seconds=remaining_time mod 60 if remaining_minutes = 3.000000000000000 and remaining_seconds=0 then print "3 minutes remaining." sleep 1000 end if if a$ =" " then print fix(minutes)," minutes and ",fix(seconds)," seconds" end if if a$ ="r" then print fix(remaining_minutes)," minutes and ", remaining_seconds," seconds remaining." end if if time_limit<=stop_timer-start_timer then print "Time is up." for i = 1 to 20 print chr$(7) sleep 1000 next i 'clear variables then start over' goto start_over end if wend stopwatch_only: start_timer=timer print "Press the s key to stop the stopwatch." while a$ <> "s" stop_timer=timer a$=inkey$ if stop_timer-start_timer < 60 then seconds=stop_timer-start_timer else minutes=(stop_timer-start_timer)/60 seconds=(stop_timer-start_timer) mod 60 end if if a$ =" " then print fix(minutes)," minutes and ",fix(seconds)," seconds" end if wend start_over: a$="" choice$="" start_timer=0 stop_timer=0 minutes=0 seconds=0 goto prompt