Skip to content

Commit 78c416a

Browse files
committed
Updated Changes
1 parent f3f3c06 commit 78c416a

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
const input = require('readline-sync');
2+
3+
let expression1 = 5 > 7;
4+
let expression2 = 420 >= 69;
5+
6+
console.log(expression1 || expression2);
7+
console.log(!expression1 && expression2);
8+
9+
console.log(5 == "5");
10+
11+
let myName = input.question("What's your name? ");
12+
let myAge = Number(input.question("\nHow old are you? "));
13+
let myPhrase;
14+
15+
if (myAge < 18) {
16+
myPhrase = "Parental supervision advised.";
17+
} else if (myAge < 26) {
18+
myPhrase = "Imagine paying for health insurance...";
19+
} else {
20+
myPhrase = "Imagine having health insurance... ☹️";
21+
}
22+
23+
console.log("\nHello, " + myName + ". " + myPhrase);
24+
25+
const input = require('readline-sync');
26+
27+
// instantiate variables
28+
let hoursInWeek = 168;
29+
30+
let sleepHours = 56;
31+
let workHours = 40;
32+
let miscHours = 21;
33+
let studyHours = 18;
34+
35+
// create variable to reduce clutter
36+
let necessities = sleepHours + workHours + miscHours + studyHours;
37+
38+
// instantiate hours spent gaming on teh daily, then multiply by 7 to update leisureHours
39+
let dailyGaming = Number(input.question("How many hours a day would you like to spend playing Baldur's Gate 3? "));
40+
let leisureHours = dailyGaming * 7;
41+
42+
// give user feedback
43+
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");
44+
45+
// additional feedback based on whether they have exceeded total hours in a week
46+
if (necessities + leisureHours > hoursInWeek) {
47+
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.");
48+
} else {
49+
console.log("Cool. That sounds like a balanced schedule. You'll have about " + (hoursInWeek -necessities + leisureHours) + " hours leftover to spend how you'd like.");
50+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,66 @@
11
// Initialize Variables below
22

3+
let date = "Monday 2019-03-18"
4+
let time = "10:05:34 AM"
5+
let astronautCount = 7
6+
let astronautStatus = "ready"
7+
let averageAstronautMassKg = 80.7
8+
let crewMassKg = astronautCount * averageAstronautMassKg
9+
let fuelMassKg = 760000
10+
let shuttleMassKg = 74842.31
11+
let totalMassKg = crewMassKg + fuelMassKg + shuttleMassKg
12+
let maxiumMassLimit = 850000
13+
let fuelTempCelsius = -225
14+
let minimumFuelTemp = -300
15+
let maximumFuelTemp = -150
16+
let fuelLevel = 100%
17+
let weatherStatus = "clear"
18+
let preparedForLiftOff = true
19+
320
// add logic below to verify total number of astronauts for shuttle launch does not exceed 7
421

22+
if (astronautCount <= 7) {
23+
console.log('this mission cannot have' + '' + astronautCount + '' + 'astronauts on board');
24+
preparedForLiftOff = false;
25+
}
26+
527
// add logic below to verify all astronauts are ready
628

29+
if (astronautStatus !== "ready") {
30+
console.log("Not all" + '' + astronautCount + '' + 'astronauts are ready for launch');
31+
preparedForLiftOff = false;
32+
}
33+
734
// add logic below to verify the total mass does not exceed the maximum limit of 850000
835

36+
if (totalMassKg > maxiumMassLimit) {
37+
console.log("Total mass exceeds the max limit. Shutting down.");
38+
preparedForLiftOff = false;
39+
}
40+
941
// add logic below to verify the fuel temperature is within the appropriate range of -150 and -300
1042

43+
if (fuelTempCelsius < minimumFuelTemp || fuelTempCelsius > maximumFuelTemp ) {
44+
console.log("Fuel temp is outside of range.");
45+
preparedForLiftOff = false;
46+
}
47+
1148
// add logic below to verify the fuel level is at 100%
1249

50+
if (fuelLevel !== "100%") {
51+
console.log("Fuel level is insufficient.");
52+
preparedForLiftOff = false;
53+
}
54+
1355
// add logic below to verify the weather status is clear
1456

57+
if (weatherStatus !== "clear") {
58+
console.log("Weather status is not clear.");
59+
preparedForLiftOff = false;
60+
}
61+
1562
// Verify shuttle launch can proceed based on above conditions
63+
64+
if (preparedForLiftOff) {
65+
console.log('All systems are go! Initiating space shuttle launch sequence.')
66+
}

0 commit comments

Comments
 (0)