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