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 fuelTemplCelsius = - 225
13
+ let minimumFuelTemp = - 300
14
+ let maximumFuelTemp = - 150
15
+ let fuelLevel = "100%"
16
+ let weatherStatus = "clear"
17
+ let preparedForLiftOff = false
18
+ let divider = "------------------------------------------"
2
19
20
+ console . log ( "Assessing pre-liftoff requirements...\n" , divider + "\n" , date + "\n" , time )
3
21
// add logic below to verify total number of astronauts for shuttle launch does not exceed 7
4
-
22
+ if ( astronautCount > 7 ) {
23
+ console . log ( "Too many astronauts!" ) ;
24
+ preparedForLiftOff = false ;
25
+ } else {
26
+ console . log ( "There are a normal amount of astronauts." ) ;
27
+ }
5
28
// add logic below to verify all astronauts are ready
6
-
29
+ if ( astronautStatus != "ready" ) {
30
+ console . log ( "The astronauts refused!" ) ;
31
+ preparedForLiftOff = false ;
32
+ } else {
33
+ console . log ( "The astronauts are good to go." )
34
+ }
7
35
// add logic below to verify the total mass does not exceed the maximum limit of 850000
8
-
36
+ if ( totalMassKg > maximumMassLimit ) {
37
+ console . log ( "Total mass EXCEEDED" )
38
+ preparedForLiftOff = false ;
39
+ } else {
40
+ console . log ( "Total mass NOT exceeded" )
41
+ }
9
42
// add logic below to verify the fuel temperature is within the appropriate range of -150 and -300
10
-
43
+ if ( fuelTemplCelsius < - 300 || fuelTemplCelsius > - 150 ) {
44
+ console . log ( "Fuel temperature irregular." )
45
+ preparedForLiftOff = false ;
46
+ } else {
47
+ console . log ( "Fuel temperature normal!" )
48
+ }
11
49
// add logic below to verify the fuel level is at 100%
12
-
50
+ if ( fuelLevel === "100%" ) {
51
+ console . log ( "Fuel level 100%." )
52
+ } else {
53
+ console . log ( "Fueling required!" )
54
+ preparedForLiftOff = false ;
55
+ }
13
56
// add logic below to verify the weather status is clear
14
-
57
+ if ( weatherStatus === "clear" ) {
58
+ console . log ( "Weather is clear." )
59
+ } else {
60
+ console . log ( "Weather does not meet standard." )
61
+ preparedForLiftOff = false ;
62
+ }
63
+ console . log ( divider )
15
64
// Verify shuttle launch can proceed based on above conditions
65
+ if ( preparedForLiftOff == false ) {
66
+ console . log ( "Cannot liftoff at this time. Hold out astronauts!" )
67
+ } else {
68
+ console . log ( "Prepare for liftoff. Have fun astronauts!" )
69
+ }
0 commit comments