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