MAC LAPTOP REQUIRED AND XCODE Hello I have uploaded the assignment is the pictures there is explanation video and everything .there is 3 more pictures I couldn’t upload her for the same question .

* Running Lab – Operators

{}

IM

R>

U

33 <
Lab - Operators ) 1. Exercise - Basic Arithmetic
Exercise - Basic Arithmetic
You decide to build a shed and want to know beforehand the area of your yard that it will take up. Create two constants, width and height, with values of 10 and 20, respectively. Create an area constant that is
the result of multiplying the two previous constants together, and print out the result.
6
7
You decide that you'll divide your shed into two rooms. You want to know if dividing it equally will leave enough room for some of your larger storage items. Create a roomArea constant that is the result of dividing
area in half. Print out the result.
11
12
Create a perimeter constant whose value equals width plus width plus height plus height, then print out the result.
16
17
Print what you would expect the result of integer division of 10 divided by 3 to be. Create a constant, integerDivisionResult that is the result of 10 divided by 3, and print the value.
21
22
Now create two constants, double10 and double3, set to 10 and 3, and declare their types as Double values. Declare a final constant divisionResult equal to the result of double10 divided by double3. Print
the value of divisionResult. How does this differ from the value when using integer division?
26
27
Given the value pi (3.1415927), create a radius constant with a value of 5.0, then calculate the diameter and circumference of the circle using the following equations, and print the results:
diameter = 2 * radius
circumference = 2 * pi * radius.
Running Lab - Operators
{}
R>

U

33 <
Lab - Operators )
2. App Exercise - Fitness Calculations
App Exercise - Fitness Calculations
Note
These exercises reinforce Swift concepts in the context of a fitness tracking app.
Your fitness tracker keeps track of users' heart rate, but you might also want to display their average heart rate over the last hour. Create three constants, heartRate1, heartRate2, and heartRate3. Give each
constant a different value between 60 and 100. Create a constant addedHR equal to the sum of all three heart rates. Now create a constant called averageHR that equals addedHR divided by 3 to get the average.
Print the result.
8
9
Now create three more constants, heartRateld, heartRate2D, and heartRate3D, equal to the same values as heartRate1, heartRate2, and heartRate3. These new constants should be of type Double.
Create a constant addedHRD equal to the sum of all three heart rates. Create a constant called averageHRD that equals the addedHRD divided by 3 to get the average of your new heart rate constants. Print the
result. Does this differ from your previous average? Why or why not?
13
14
Imagine that partway through the day a user has taken 3,467 steps out of the 10,000 step goal. Create constants steps and goal. Both will need to be of type Double so that you can perform accurate calculations.
steps should be assigned the value 3,467, and goal should be assigned 10,000. Create a constant percentOfGoal that equals an expression that evaluates to the percent of the goal that has been achieved so far.
18
19
Previous | page 2 of 8 | Next: Exercise - Compound Assignment
21
* Running Lab - Operators
{}
R>

U

33 <
Lab - Operators )
3. Exercise - Compound Assignment
Exercise - Compound Assignment
Declare a variable whose value begins at 10. Using addition, update the value to 15 using the compound assignment operator. Using multiplication, update the value to 30 using compound assignment. Print out the
variable's value after each assignment.
6
7
Create a variable called piggyBank that begins at 0. You will use this to keep track of money you earn and spend. For each point below, use the right compound assignment operator to update the balance in your
piggy bank.
O
Your neighbor gives you 10 dollars for mowing her lawn
You earn 20 more dollars throughout the week doing odd jobs
You spend half your money on dinner and a movie
You triple what's left in your piggy bank by washing windows
You spend 3 dollars at a convenience store
O
O
Print the balance of your piggy bank after each step.
19
20
21
22
23
Previous | page 3 of 8 | Next: App Exercise - Counting
25
Ace Exercise Fares Calculation
* Running Lab - Operators
{}
R>

U

33 <
Lab - Operators )
4. App Exercise - Counting
App Exercise - Counting
Note
These exercises reinforce Swift concepts in the context of a fitness tracking app.
The most basic feature of your fitness tracking app is counting steps. Create a variable steps and set it equal to 0. Then increment its value by 1 to simulate a user taking a step.
8
9
In addition to tracking steps, your fitness tracking app tracks distance traveled. Create a variable distance of type Double and set it equal to 50. This will represent the user having traveled 50 feet.
You decide, however, to display the distance in meters. 1 meter is approximately equal to 3 feet. Use a compound assignment operator to convert distance to meters. Print the result.
15
16
Previous | page 4 of 8 | Next: Exercise - Order of Operations
18
Exercise-Compound Assigen
Running Lab - Operators
{}
R>

U

33 <
Lab - Operators)
5. Exercise - Order of Operations
Exercise - Order of Operations
Print out what you think 10 + 2 * 5 evaluates to. Then print out the actual expression (i.e. print(10 + 2 * 5))
6
7
In a separate print statement, add in the necessary parentheses so that addition takes place before multiplication.
11
12
Print out what you think 4 * 9 - 6/2 evaluates to. Then print out the actual expression.
16
17
In a separate print statement, add in the necessary parentheses so that the subtraction is prioritized over the multiplication and division.
21
22
Previous page 5 of 8 | Next: App Exercise - Complex Fitness Calculations
24
Ace Exercise Curting
Purchase answer to see full
attachment