Bedtime

 

10 points

 

Introduction

This program calculates the time (hours and minutes) until the user's bedtime. It includes text inputs for the hour and minute of the user's bedtime. It uses the Date class to find the current hour and minute. (The Date class operates on a 24-hour clock, a.k.a. "military time". So, for example, 6 p.m. would be 18:00 in the Date class.) And the app does some math to calculate the time until the user's bedtime.

You can use 'eval' to tell App Lab that you want a variable to store a number instead of a string. For example:

bedHour = eval(getText("txtBedHour"));

You'll include code for the situation where the user goes to bed at, say, 1 or 2 in the morning.

You'll include code for the situation where the minutes of the bedtime are less than the minutes of the present time. You don't want to report a negative value for minutes until bedtime.

 

Video

The video shows what a completed app should do.