|
1 |
| -// Initialize Variables below |
| 1 | +let date = "Monday 2019-03-18"; |
| 2 | +let time = "10:05:34 AM"; |
| 3 | +let astronautCount = 7; |
| 4 | +let astronautStatus = "ready"; |
| 5 | +let averageAstronautMassKg = 80.7; |
| 6 | +let crewMassKg = astronautCount * averageAstronautMassKg; |
| 7 | +let fuelMassKg = 760000; |
| 8 | +let shuttleMassKg = 74842.31; |
| 9 | +let totalMassKg = crewMassKg + fuelMassKg + shuttleMassKg; |
| 10 | +let maximumMassLimit = 850000; |
| 11 | +let fuelTempCelsius = -255; |
| 12 | +let minimumFuelTemp = -300; |
| 13 | +let maximumFuelTemp = -150; |
| 14 | +let fuelLevel = 100; |
| 15 | +let weatherStatus = "clear"; |
| 16 | +let preparedForLiftOff = false; |
| 17 | + |
| 18 | +// add logic below to verify total number of astronauts for shuttle launch does not exceed 7 |
| 19 | + |
| 20 | +if (astronautCount <= 7) { |
| 21 | + |
| 22 | + |
| 23 | +// add logic below to verify all astronauts are ready |
| 24 | + |
| 25 | + if (astronautStatus === "ready") { |
| 26 | + |
| 27 | +// add logic below to verify the total mass does not exceed the maximum limit of 850000 |
| 28 | + |
| 29 | + if (totalMassKg < maximumMassLimit) { |
| 30 | + |
| 31 | +// add logic below to verify the fuel temperature is within the appropriate range of -150 and -300 |
| 32 | + |
| 33 | + if (fuelTempCelsius >= -300 || fuelTempCelsius <= -150) { |
| 34 | + |
| 35 | +// add logic below to verify the fuel level is at 100% |
| 36 | + |
| 37 | + if (fuelLevel === 100) { |
| 38 | + |
| 39 | +// add logic below to verify the weather status is clear |
| 40 | + |
| 41 | + if (weatherStatus === "clear") { |
| 42 | + |
| 43 | +// Verify shuttle launch can proceed based on above conditions |
| 44 | + |
| 45 | + preparedForLiftOff = true; |
| 46 | + } |
| 47 | + } |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | +} else { |
| 52 | + preparedForLiftOff = false; |
| 53 | +} |
| 54 | +if (preparedForLiftOff) { |
| 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: " + crewMassKg + " kg"); |
| 60 | + console.log("Fuel Mass: " + fuelMassKg + " kg"); |
| 61 | + console.log("Shuttle Mass: " + shuttleMassKg + " kg"); |
| 62 | + console.log("Total Mass: " + totalMassKg + " kg"); |
| 63 | + console.log("Fuel Temperature: " + fuelTempCelsius + " C"); |
| 64 | + console.log("Weather Status: " + weatherStatus); |
| 65 | + console.log("Have a safe trip astronauts!"); |
| 66 | +} else { |
| 67 | + console.log("Shut down laucnh operations!"); |
| 68 | +}// Initialize Variables below |
2 | 69 |
|
3 | 70 | // add logic below to verify total number of astronauts for shuttle launch does not exceed 7
|
4 | 71 |
|
|
0 commit comments