Congratulations! ๐Ÿ™Œ

Here are some of the major concepts:

  • An if statement checks a condition and will execute a task if that condition evaluates to true.
  • if / else statements make binary decisions and execute different code blocks based on a provided condition.
  • We can add more conditions using else if statements.
  • Relational operators, including <, >, <=, >=, ==, and != can compare two values.
  • A switch statement can be used to simplify the process of writing multiple else if statements. The break keyword stops the remaining cases from being checked and executed in a switch statement.



Optional: Little Mac is an interplanetary space boxer, who is trying to win championship belts for various weight categories on other planets within the solar system.

Write a space.cpp program that helps him keep track of his target weight by:

  1. It should ask him what his earth weight is.
  2. Ask him to enter a number for the planet he wants to fight on.
  3. It should then compute his weight on the destination planet.

Here is the table of conversion:

# Planet Relative Gravity
1 Mercury 0.38
2 Venus 0.91
3 Mars 0.38
4 Jupiter 2.34
5 Saturn 1.06
6 Uranus 0.92
7 Neptune 1.19

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?