Skip to content

Commit 77db725

Browse files
committed
Shuttle Launch Cleared for lift off
1 parent 55f7ff9 commit 77db725

File tree

1 file changed

+56
-3
lines changed

1 file changed

+56
-3
lines changed
Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,68 @@
11
// Initialize Variables below
2+
let date = "Monday 2019-03-18";
3+
let time = "10:05:34 AM";
4+
let astronautCount = 7;
5+
let astronautStatus = "ready";
6+
let averageAstronautMassKg = 80.7;
7+
let crewMassKg = astronautCount * averageAstronautMassKg;
8+
let fuelMassKg = 760000;
9+
let shuttleMassKg = 74842.31;
10+
let totalMassKg = crewMassKg + fuelMassKg + shuttleMassKg;
11+
let maximumMassLimit = 850000;
12+
let fuelTempCelsius = -225;
13+
let minimumFuelTemp = -300;
14+
let maximumFuelTemp = -150;
15+
let fuelLevel = "100%";
16+
let weatherStatus = "clear";
17+
let prepareForLiftOff = true;
218

319
// add logic below to verify total number of astronauts for shuttle launch does not exceed 7
4-
20+
let isClearedForLiftOff = true;
21+
if (astronautCount > 7) {
22+
isClearedForLiftOff = false;
23+
console.log("Astronaut count exceeds limit.");
24+
}
525
// add logic below to verify all astronauts are ready
6-
26+
if (astronautStatus !== "ready") {
27+
isClearedForLiftOff = false;
28+
console.log("Astronaut status not ready");
29+
}
730
// add logic below to verify the total mass does not exceed the maximum limit of 850000
31+
if (totalMassKg >= maximumMassLimit) {
32+
isClearedForLiftOff = false;
33+
console.log("Total mass exceeds maximum mass limit.");
34+
}
835

936
// add logic below to verify the fuel temperature is within the appropriate range of -150 and -300
37+
if (fuelTempCelsius < minimumFuelTemp || fuelTempCelsius > maximumFuelTemp) {
38+
isClearedForLiftOff = false;
39+
console.log("Fuel temperature out of acceptable range.");
40+
}
1041

1142
// add logic below to verify the fuel level is at 100%
43+
if (fuelLevel !== "100%") {
44+
isClearedForLiftOff = false;
45+
console.log("Fuel level not at 100%.");
46+
}
1247

1348
// add logic below to verify the weather status is clear
14-
49+
if (weatherStatus !== "clear") {
50+
isClearedForLiftOff = false;
51+
console.log("Weather status not clear.");
52+
}
1553
// Verify shuttle launch can proceed based on above conditions
54+
if (isClearedForLiftOff && prepareForLiftOff) {
55+
console.log("All systems are a go! Initiating space shuttle launch sequence.");
56+
console.log("Date:", date);
57+
console.log("Time:", time);
58+
console.log("Astronaut Count:", astronautCount);
59+
console.log("Crew Mass (kg):", crewMassKg);
60+
console.log("Fuel mass (kg):", fuelMassKg);
61+
console.log("Shuttle Mass (kg):", shuttleMassKg);
62+
console.log("Total Mass (kg):", totalMassKg);
63+
console.log("Fuel Temperatture (Celsius):", fuelTempCelsius);
64+
console.log("Weather Status:", weatherStatus);
65+
console.log("Have a safe trip astronauts!");
66+
} else {
67+
console.log("Launch operations aborted.");
68+
}

0 commit comments

Comments
 (0)