|
1 | 1 | // Initialize Variables below
|
2 | 2 |
|
| 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 maximumMassLimit = 850000; |
| 13 | +const fuelTempCelsius = -225; |
| 14 | +const minimumFuelTemp = -300; |
| 15 | +const fuelLevel = "100%"; |
| 16 | +const weatherStatus = "clear"; |
| 17 | +let preparedForLiftOff = true; |
| 18 | +let readyCheck = 0; |
| 19 | + |
| 20 | + |
3 | 21 | // add logic below to verify total number of astronauts for shuttle launch does not exceed 7
|
4 | 22 |
|
| 23 | +if (astronautCount <= 7) { |
| 24 | + console.log("Crew accounted for."); |
| 25 | + //console.log("Ready Check ") |
| 26 | + readyCheck += 1; |
| 27 | +} |
| 28 | + |
| 29 | + |
| 30 | + |
5 | 31 | // add logic below to verify all astronauts are ready
|
6 | 32 |
|
| 33 | +if (astronautStatus === 'ready') { |
| 34 | + console.log("Crew ready."); |
| 35 | + readyCheck += 1; |
| 36 | +} |
| 37 | + |
7 | 38 | // add logic below to verify the total mass does not exceed the maximum limit of 850000
|
| 39 | + //if the totalMassKg is less than the maximumMassLimit of 850000 |
| 40 | +if (totalMassKg < maximumMassLimit) { |
| 41 | + console.log("Total Mass Kg within limit."); |
| 42 | + readyCheck += 1; |
| 43 | +} |
| 44 | + |
8 | 45 |
|
9 | 46 | // add logic below to verify the fuel temperature is within the appropriate range of -150 and -300
|
| 47 | + // if the fuelTempCelsius is no less than -300 OR no greater than -150 |
| 48 | + |
| 49 | +if (fuelTempCelsius > -300 || fuelTempCelsius < -150) { |
| 50 | + console.log("Fuel Temp in range."); |
| 51 | + readyCheck += 1; |
| 52 | +} |
10 | 53 |
|
11 | 54 | // add logic below to verify the fuel level is at 100%
|
12 | 55 |
|
| 56 | +if (fuelLevel === "100%") { |
| 57 | + console.log("Fuel Tank is Full."); |
| 58 | + readyCheck += 1; |
| 59 | +} |
| 60 | + |
13 | 61 | // add logic below to verify the weather status is clear
|
14 | 62 |
|
| 63 | +if (weatherStatus === "clear") { |
| 64 | + console.log("Sky is Clear."); |
| 65 | + readyCheck += 1; |
| 66 | +} |
| 67 | + |
15 | 68 | // Verify shuttle launch can proceed based on above conditions
|
| 69 | +if (readyCheck === 6) { |
| 70 | + console.log(`Ready Check: ${readyCheck}/6`); |
| 71 | + console.log("All systems are a go! Initiating space shuttle launch sequence."); |
| 72 | + console.log(""); |
| 73 | + console.log("░I░N░I░T░I░A░L░I░Z░I░N░G░"); |
| 74 | + console.log(`Date: ${date}`); |
| 75 | + console.log(`Time: ${time}`); |
| 76 | + console.log(`Astronaut Count: ${astronautCount}`); |
| 77 | + console.log(`Crew Mass: ${crewMassKg} kg`); |
| 78 | + console.log(`Fuel Mass: ${fuelMassKg} kg`); |
| 79 | + console.log(`Shuttle Mass: ${shuttleMassKg} kg`); |
| 80 | + console.log(`Total Mass: ${totalMassKg} kg`); |
| 81 | + console.log(`Fuel Temperature: ${fuelTempCelsius} °C`); |
| 82 | + console.log(`Weather Status: ${weatherStatus}`); |
| 83 | + console.log("░I░N░I░T░I░A░T░I░N░G░ ░L░A░U░N░C░H░ ░S░E░Q░U░E░N░C░E░"); |
| 84 | + console.log(""); |
| 85 | + console.log("(人´∀`).☆.。.:* Have a safe trip astronauts! ☆彡"); |
| 86 | +} else { |
| 87 | + ("Scrub launch...") |
| 88 | +} |
| 89 | + |
0 commit comments