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 fuelTempCelcius = - 225
13
+ let minimumFuelTemp = - 300
14
+ let maximumFuelTemp = - 150
15
+ let fuelLevel = 100
16
+ let weatherStatus = "clear"
17
+ let preparedForLiftoff = true
2
18
3
19
// add logic below to verify total number of astronauts for shuttle launch does not exceed 7
20
+ if ( astronautCount => 7 ) {
21
+ console . log ( "Astronaut count: " + astronautCount ) ;
22
+ }
4
23
5
24
// add logic below to verify all astronauts are ready
6
-
25
+ if ( astronautStatus == "Ready" ) {
26
+ console . log ( "Astronauts are ready!" ) ;
27
+ } else {
28
+ console . log ( "Astronauts are not ready!" ) ;
29
+ }
7
30
// add logic below to verify the total mass does not exceed the maximum limit of 850000
31
+ if ( totalMassKg <= 850000 ) {
32
+ console . log ( "Total Mass: " + totalMassKg + "kg" ) ;
33
+ } else {
34
+ console . log ( "Too heavy!" ) ;
35
+ }
8
36
9
37
// add logic below to verify the fuel temperature is within the appropriate range of -150 and -300
38
+ if ( fuelTempCelcius > minimumFuelTemp && fuelTempCelcius < maximumFuelTemp ) {
39
+ console . log ( "Fuel Temperature: " + fuelTempCelcius ) ;
40
+ } else {
41
+ console . log ( "Check the fuel temperatures." ) ;
42
+ }
10
43
11
44
// add logic below to verify the fuel level is at 100%
45
+ if ( fuelLevel == 100 ) {
46
+ console . log ( "Fuel level: " + fuelLevel + "%" ) ;
47
+ } else {
48
+ console . log ( "Add more fuel" ) ;
49
+ }
12
50
13
51
// add logic below to verify the weather status is clear
14
-
52
+ if ( weatherStatus == "clear" ) {
53
+ console . log ( "Weather status: " + weatherStatus ) ;
54
+ }
15
55
// Verify shuttle launch can proceed based on above conditions
56
+ console . log ( "Crew Mass: " + crewMassKg + "kg" + '\n' +
57
+ "Fuel Mass: " + fuelMassKg + "kg" + '\n' +
58
+ "Shuttle Mass: " + shuttleMassKg + "kg" + '\n' +
59
+ "Date: " + date + '\n' +
60
+ "Time: " + time + '\n' +
61
+ "Have a safe flight!" )
0 commit comments