|
1 | 1 | // 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; |
2 | 18 |
|
3 | 19 | // 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 | +} |
5 | 25 | // 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 | +} |
7 | 30 | // 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 | +} |
8 | 35 |
|
9 | 36 | // 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 | +} |
10 | 41 |
|
11 | 42 | // 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 | +} |
12 | 47 |
|
13 | 48 | // 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 | +} |
15 | 53 | // 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