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

Note

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:

  1. Initializing variables with shuttle specifications.
  2. Writing conditional statements to check if your shuttle meets specific requirements and is cleared for LiftOff.
  3. 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.

VariableValue
dateMonday 2019-03-18
time10:05:34 AM
astronautCount7
astronautStatusready
averageAstronautMassKg80.7
crewMassKgastronautCount * averageAstronautMassKg
fuelMassKg760,000
shuttleMassKg74842.31
totalMassKgcrewMassKg + fuelMassKg + shuttleMassKg
maximumMassLimit850000
fuelTempCelsius-225
minimumFuelTemp-300
maximumFuelTemp-150
fuelLevel100%
weatherStatusclear
preparedForLiftOfftrue

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:

  1. if astronautCount is no greater than 7
  2. if astronautStatus is ready
  3. if the totalMassKg is less than the maximumMassLimit of 85000
  4. if the fuelTempCelsius is no less than -300 OR no greater than -150
  5. if fuelLevel is at 100%
  6. if weatherStatus is clear

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.

  1. date
  2. time
  3. astronautCount
  4. crewMassKg
  5. fuelMassKg
  6. shuttleMassKg
  7. totalMasskg
  8. fuelTempCelsius
  9. weatherStatus
  10. Wish your astronauts a safe flight!

Example Output

Example Output of Successful Shuttle Launch