Studio: Shuttle Launch
In this studio, you are going to write code to verify that your Space Shuttle is prepared for LiftOff! This activity will combine knowledge you have gained from this chapter and the Data and Variables Chapter
The starter code for this studio can be found inside of the following repository: javascript-projects
within the booleans-and-conditionals
directory.
This studio activity will consist of 3 parts:
- Initializing variables with shuttle specifications.
- Writing conditional statements to check
if
your shuttle meets specific requirements and is cleared for LiftOff. - Verify that all conditional statements have passed in order to launch the shuttle, otherwise aborting the launch sequence.
Initialize Variables
Start out by creating the below variables with the given values. Remember to account for different data types.
Variable | Value |
---|---|
date | Monday 2019-03-18 |
time | 10:05:34 AM |
astronautCount | 7 |
astronautStatus | ready |
averageAstronautMassKg | 80.7 |
crewMassKg | astronautCount * averageAstronautMassKg |
fuelMassKg | 760,000 |
shuttleMassKg | 74842.31 |
totalMassKg | crewMassKg + fuelMassKg + shuttleMassKg |
maximumMassLimit | 850000 |
fuelTempCelsius | -225 |
minimumFuelTemp | -300 |
maximumFuelTemp | -150 |
fuelLevel | 100% |
weatherStatus | clear |
preparedForLiftOff | true |
Conditional Statements
We want to make sure that the following conditions are met in order for our shuttle to launch. Create a statement for each condition:
- if
astronautCount
is no greater than 7 - if
astronautStatus
is ready - if the
totalMassKg
is less than themaximumMassLimit
of850000
- if the
fuelTempCelsius
is no less than-300
OR no greater than-150
- if
fuelLevel
is at100%
- if
weatherStatus
isclear
Verify the Shuttle is Cleared for LiftOff
Once you have completed the above conditions, print out the following shuttle information below and wish your astronauts a safe flight! If the above conditions are not met, shut down the launch operations.
- date
- time
- astronautCount
- crewMassKg
- fuelMassKg
- shuttleMassKg
- totalMasskg
- fuelTempCelsius
- weatherStatus
- Wish your astronauts a safe flight!