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