/UsingVariables

The second project for iOS pre-course using variables.

Primary LanguageObjective-C

UsingVariables

The second project for iOS pre-course using variables.

Resources:

Step 1: Get the project started on your computer and on GitHub

  • Either create a project locally and push to GitHub
  • Or fork this project and clone it to your computer

Note:

  • For more detailed instructions of 'Step 1' see the first project
  • 'Step 1' is something we will do hundreds of times in class. You need to be able to do it quickly and without running into issues so it doesn't slow class down.

Step 2: Add a BMI calculator

  • Remember that we're working in the AppDelegate file in the "didFinishLaunchingWithOptions" fuction
  • Declare two variables (height and weight with the type CGFloat)
  • Store values in each of them (height = 71.0 and weight = 185.0)
  • Declare a new varriable (bodyMassIndex with the type CGFloat)
  • And set it to (weight / (height * height)) * 703
  • Log the weight to the console

Completion:

  • It should print that the BMI is 25.799444
  • Feel free to play with the height and weight and see what gets printed