Skip to content

Commit 98f26c7

Browse files
committed
chapter 5 studio group work
1 parent 1e74c1e commit 98f26c7

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed
Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,49 @@
11
// 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;
318
// add logic below to verify total number of astronauts for shuttle launch does not exceed 7
19+
if (astronautCount <= 7 )
420

521
// add logic below to verify all astronauts are ready
6-
22+
if (astronautStatus === "ready")
723
// add logic below to verify the total mass does not exceed the maximum limit of 850000
8-
24+
if (totalMassKg <= maximumMassLimit)
925
// add logic below to verify the fuel temperature is within the appropriate range of -150 and -300
10-
26+
if (fuelTempCelsius >= minimumFuelTemp && fuelTempCelsius <= maximumFueltemp )
1127
// add logic below to verify the fuel level is at 100%
12-
28+
if (fuelLevel === "100%")
1329
// add logic below to verify the weather status is clear
30+
if (weatherStatus === "clear");
1431

1532
// 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

Comments
 (0)