forked from LaunchCodeEducation/javascript-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-variables-conditionals.js
More file actions
57 lines (56 loc) · 2.01 KB
/
data-variables-conditionals.js
File metadata and controls
57 lines (56 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Initialize Variables below
let date = "Monday 2019-03-18";
let time = "10:05:34 AM";
let astronautCount = 7
let astronautStatus = "ready";
let averageAstronautMassKg = 80.7;
let crewMassKg = astronautCount * averageAstronautMassKg;
let fuelMassKg = 760000
let shuttleMassKg = 74842.31
let totalMassKg = crewMassKg + fuelMassKg + shuttleMassKg;
let maximumMassLimit = 85000;
let fuelTempCelsius = -225;
let minimumFuelTemp = -300;
let maximumFuelTemp = -150;
let fuelLevel = 100;
let weatherStatus = "clear";
let preparedForLiftOff = true;
// add logic below to verify total number of astronauts for shuttle launch does not exceed 7
if (astronautCount > 7) {
preparedForLiftOff = false
}
// add logic below to verify all astronauts are ready
if (astronautStatus === "not ready") {
preparedForLiftOff = false
}
// add logic below to verify the total mass does not exceed the maximum limit of 850000
if (totalMassKg > maximumMassLimit) {
preparedForLiftOff = false
}
// add logic below to verify the fuel temperature is within the appropriate range of -150 and -300
if (fuelTempCelsius >= -300 || fuelTempCelsius <= -150){
preparedForLiftOff = false
}
// add logic below to verify the fuel level is at 100%
if (fuelLevel !== 100) {
preparedForLiftOff = false
}
// add logic below to verify the weather status is clear
if (weatherStatus === "not clear") {
preparedForLiftOff = false
}
// Verify shuttle launch can proceed based on above conditions
if (preparedForLiftOff = true) {
console.log("Date: " + date)
console.log("Time: " + time)
console.log("Astronaut Count: " +astronautCount)
console.log("Crew Mass: " + crewMassKg)
console.log("Fuel Mass: " + fuelMassKg)
console.log("Shuttle Mass: " + shuttleMassKg)
console.log("Total Mass: " + totalMassKg)
console.log("Fuel Temp: " + fuelTempCelsius)
console.log("Weather Status: " + weatherStatus)
console.log("Have a safe flight!")
} else {
console.log("Launch Sequence Shut Down")
}