Created
May 28, 2017 03:56
-
-
Save MortalCatalyst/41f59d613bf50da6929896fd24c7d8cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSleepHours(day){ | |
hours = prompt("How long did you sleep on "+ day + "? "); | |
return Number(hours); | |
} | |
function getActualSleepHours() { | |
Monday = getSleepHours("Monday"); | |
Tuesday = getSleepHours("Tuesday"); | |
Wednesday = getSleepHours("Wednesday"); | |
Thursday = getSleepHours("Thursday"); | |
Friday = getSleepHours("Friday"); | |
Saturday = getSleepHours("Saturday"); | |
Sunday = getSleepHours("Sunday"); | |
Total_Sleep = Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Sunday; | |
return Total_Sleep; | |
} | |
function getIdealSleepHours() { | |
Sleep = prompt("How much sleep a day do you like? "); | |
Weeks_Sleep = sleep * 7; | |
} | |
function calculateSleepDebt() { | |
actualSleepHours = getActualSleepHours(); | |
idealSleepHours = getIdealSleepHours(); | |
overUnderHours = actualSleepHours - idealSleepHours; | |
if (actualSleepHours === idealSleepHours) { | |
console.log("You got the ideal sleep"); | |
} | |
else if (actualSleepHours > idealSleepHours) { | |
console.log("You overslept " + overUnderHours + " hours go for a jog."); | |
} else { | |
console.log("You are short " + overUnderHours + " hours sleep need to get some rest."); | |
} | |
} | |
getSleepHours(Monday); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment