|
1 | 1 | // Initialize Variables below
|
2 |
| - |
| 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 preparedForLiftoff = false; |
3 | 18 | // add logic below to verify total number of astronauts for shuttle launch does not exceed 7
|
4 |
| - |
5 |
| -// add logic below to verify all astronauts are ready |
6 |
| - |
7 |
| -// add logic below to verify the total mass does not exceed the maximum limit of 850000 |
8 |
| - |
9 |
| -// add logic below to verify the fuel temperature is within the appropriate range of -150 and -300 |
10 |
| - |
11 |
| -// add logic below to verify the fuel level is at 100% |
12 |
| - |
13 |
| -// add logic below to verify the weather status is clear |
| 19 | +if (astronautCount <= 7) { |
| 20 | + // add logic below to verify all astronauts are ready |
| 21 | + if (astronautStatus = 'ready') { |
| 22 | + // add logic below to verify the total mass does not exceed the maximum limit of 850000 |
| 23 | + if (totalMassKg <= maximumMassLimit) { |
| 24 | + // add logic below to verify the fuel temperature is within the appropriate range of -150 and -300 |
| 25 | + if (fuelTempCelsius >= -300 || fuelTempCelsius <= -150) { |
| 26 | + // add logic below to verify the fuel level is at 100% |
| 27 | + if (fuelLevel === "100%") { |
| 28 | + // add logic below to verify the weather status is clear |
| 29 | + if (weatherStatus === "clear") { |
| 30 | + preparedForLiftoff = true; |
| 31 | + } |
| 32 | + } |
| 33 | + } |
| 34 | + } |
| 35 | + } |
| 36 | +} |
| 37 | + |
14 | 38 |
|
15 | 39 | // Verify shuttle launch can proceed based on above conditions
|
| 40 | +if (preparedForLiftoff === true) { |
| 41 | + console.log("All systems go! Initiating space shuttle launch sequence."); |
| 42 | + console.log("Date: ", date); |
| 43 | + console.log("Time: ", time); |
| 44 | + console.log("Astronaut Count: ", astronautCount); |
| 45 | + console.log("Crew Mass: ", crewMassKg, "kg"); |
| 46 | + console.log("Fuel Mass: ", fuelMassKg, "kg"); |
| 47 | + console.log("Shuttle Mass: ", shuttleMassKg, "kg"); |
| 48 | + console.log("Total Mass: ", totalMassKg, "kg"); |
| 49 | + console.log("Fuel Temperature: ", fuelTempCelsius, "°C"); |
| 50 | + console.log("Weather Status: ", weatherStatus); |
| 51 | + console.log("Have a safe trip astronauts!"); |
| 52 | + |
| 53 | +} else { |
| 54 | + console.log("Liftoff conditions not met, abort mission"); |
| 55 | +} |
0 commit comments