Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Optimization And Data Science Trends And Applications 5th Airoyoung Workshop And Airo Phd School 2021 Joint Event

Authors: Adriano Masone ,Veronica Dal Sasso ,Valentina Morandi

1st Edition

3030862887, 978-3030862886

More Books

Students also viewed these Databases questions

Question

Write Hund's rule?

Answered: 1 week ago