Question
Write a defining table and then a program that determines if you can sleep in or not. Your program should get all its input from
Write a defining table and then a program that determines if you can sleep in or not. Your program should get all its input from your computers clock. On all weekdays (Monday through Friday) that are not holidays, your program should output Get up! On all other days (weekends and holidays), your program should output Sleep in. The three holidays that your program must check for are January 1 (New Years Day), July 4 (U.S. Independence Day), and December 25 (Christmas). You dont need to include other holidays in your program because most other holidays do not occur on a fixed day each year.
Within your program, use this JavaScript code that will get the current month, current day of the month, and current day of the week from your computers clock:
var now = new Date(); var month = now.getMonth(); var dayOfMonth = now.getDate(); var dayOfWeek = now.getDay();
If you use the above code, the variable month will hold 0 if the current month is January, 1 if February, and so on to 11 if December. The variable dayOfMonth will hold 1 for the first day of the month up to 28, 29, 30, or 31 for the last day of the month. The variable dayOfWeek will hold 0 if today is Sunday, 1 if today is Monday, and so on to 6 if today is Saturday.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started