forked from LaunchCodeEducation/javascript-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlecture914
More file actions
50 lines (37 loc) · 1.89 KB
/
lecture914
File metadata and controls
50 lines (37 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//const myName = input.question("Enter your name: ");
//console.log(myName);
//let expression1 = 5 > 7
//let expression2 = 420 >=69
//console.log(!expression1 && expression2);
//console.log(5 != "5");
/*let myName = input.question("What's your name? ");
let myAge = Number(input.question("\nHow old are you? "));
let myPhrase = '';
if (myAge < 18) {
myPhrase = "Parental supervision advised.";
} else if (myAge < 26) {
myPhrase = "Imagine paying for health insurance...";
} else {
myPhrase = "Imagine having health insurance... ☹️";
}
console.log("\nHello, " + myName + ". " + myPhrase);*/
const input = require('readline-sync');
// instantiate variables
let hoursInWeek = 168;
let sleepHours = 56;
let workHours = 40;
let miscHours = 21;
let studyHours = 18;
// create variable to reduce clutter
let necessities = sleepHours + workHours + miscHours + studyHours;
// instantiate hours spent gaming on teh daily, then multiply by 7 to update leisureHours
let dailyGaming = Number(input.question("How many hours a day would you like to spend playing Baldur's Gate 3? "));
let leisureHours = dailyGaming * 7;
// give user feedback
console.log("\nGotcha. You want to spend at least " + dailyGaming + " hours a day playing Baldur's Gate. That comes out to " + leisureHours + " hours spent across seven daily gaming sessions.\n");
// additional feedback based on whether they have exceeded total hours in a week
if (necessities + leisureHours > hoursInWeek) {
console.log("I think you need to reconsider your priorities. There are only " + hoursInWeek + " hours in a week, and with all your other obligations you only have " + (hoursInWeek - necessities) + " hours throughout the week to spend on leisurely activities.");
} else {
console.log("Cool. That sounds like a balanced schedule. You'll have about " + (hoursInWeek - (necessities - leisureHours)), " hours leftover to spend how you'd like.");
}