1 answer

Reinforce swift concept context of fitness tracking app

Question:

****** Result for Image/Page 1 ****** App Exercise Target Heart Rate Note These exercises reinforce Swift concepts in the context of a fitness tracking app. You decide that you want your fitness tracker to have a feature that helps users stay inside specified heart rate zones while they are working out. You'll display a message to the user telling them to go a little faster to increase their heart rate if they are below the target, tell them that they are spot on if they are in the target, and tell them to slow it down a little if they are over the target. Create constants isInTarget, isBe lowTarget, and is above the target that equal expressions that evaluate to whether or not current hr is between the lower and upper bounds, below the lower bound, and above the upper bound, respectively. Then write an if-else-if statement that will print "You're right on track!" if the user is inside the target zone, "You're doing great, but try to push it a bit!" if the user is below the target zone, and "You're on fire! Slow it down just a bit." if the user is above the target zone. 10 let target lower Bound 120 11 let target Upper Bound 150 12 let current HR = 147

Answers

Code:

let targetLowerBound = 120
let targetUpperBound = 150
let currentHR = 147

let isInTarget = (currentHR >= targetLowerBound) && (currentHR <= targetUpperBound)
let isBelowTarget = (currentHR < targetLowerBound)
let isAboveTarget = (currentHR > targetUpperBound)

if (isInTarget == true) {
print("You're right on track!")
} else if (isBelowTarget == true){
print("You're doing great, but try to push it a bit!")
}else{
print("You're on fire! Slow it down a bit.")  
}

Output:

Success #stdin #stdout OS 57640KB Youre right on track!

.

Similar Solved Questions

1 answer
This Question: 1 pt 3 of 20 (2 c Is y is a function of x?...
This Question: 1 pt 3 of 20 (2 c Is y is a function of x? Ay Which of the following statements is correct? Choose the correct answer below y is a function of x y is not a function of x Click to select your answer...
1 answer
Describe two ways you can use student alliance to obtain a job
Describe two ways you can use student alliance to obtain a job...
1 answer
Please show work Question 18 (4 points) A 5.0-kg cylinder of solid iron is supported by...
Please show work Question 18 (4 points) A 5.0-kg cylinder of solid iron is supported by a string while submerged in water. The density of iron is 7750 kg/m3 and that of water is 1000 kg/m3 a) What is the buoyant force on the cylinder? (2 pts) b) What is the tension in the string? (2 pts)...
1 answer
Check + The purchasing department manager for Campbell Company prepared the following supplies purchases budget. Campbell's...
Check + The purchasing department manager for Campbell Company prepared the following supplies purchases budget. Campbell's policy is to maintain an ending supplies balance equal to 15 percent of the following month's supplies expense. April's budgeted supplies expense is $81,000 Require...
1 answer
19. Which of the following are chain propagation reactions? (1) C 2CI (2) Cl, H. 2...
19. Which of the following are chain propagation reactions? (1) C 2CI (2) Cl, H. 2 HCI - CI (3) CH . Cie... → CH, HCI (4) CH, CI - CHCI+ CI (5) CH, CL - CHCI (6) CH. H . CH Hz a) 1 and 2 b) 2 and 5 C) 3 and 6 d) 3 and 4 e) 1 and 6 20. Which of the following correctly depicts the protonation of ...
1 answer
Question 18 (10 April 2020) 51.5 kW 12 cm Pump An oil pump is drawing 51.5...
Question 18 (10 April 2020) 51.5 kW 12 cm Pump An oil pump is drawing 51.5 kW of electric power while pumping oil with p= 860 kg/m3 at a rate of 0.23 m3/s. The inlet and outlet diameters of the piper are 8 cm and 12 cm, respectively. If the pressure rise of oil in the pump is measured to be 500 kPa ...
1 answer
Mrs. Phillips has 10 identical cans without labels. She knows that she had 1 can of peas, 5 cans of corn, 1 can of carrots, and 3 cans of beets. She opens one can. What is the probability it is carrots?Corn or beets?
Mrs. Phillips has 10 identical cans without labels. She knows that she had 1 can of peas, 5 cans of corn, 1 can of carrots, and 3 cans of beets. She opens one can. What is the probability it is carrots?Corn or beets?...
1 answer
Use the formula for continuous compounding to compute the balance in the account after 1, 5,...
Use the formula for continuous compounding to compute the balance in the account after 1, 5, and 20 years. Also, find the APY for the account AS10,000 deposit in an account with an APR of 3.75%. The balance in the account after 1 year is approximately S (Round to the nearest cent as needed) The bala...
1 answer
1) what is a solution between Wavelength, frequency of oscillatans, I and profagation speed of warres?...
1) what is a solution between Wavelength, frequency of oscillatans, I and profagation speed of warres? and want is a theoretical value of a specific heat ratio for all? 3) Specify accustre frequency range,...
1 answer
(4 points) Prove that the fractal dimension of the set 11 1 F = {0,1, U...
(4 points) Prove that the fractal dimension of the set 11 1 F = {0,1, U 4' 9' 16 equals : k=1...
1 answer
I need help. Please show steps! The uniform 80-kg slender bar is initially at rest on...
I need help. Please show steps! The uniform 80-kg slender bar is initially at rest on a smooth horizontal plane when the forces are applied. (Figure 1) Part A Determine the acceleration of the bar's mass center at this instant. Express your answer to three significant figures and include the app...
1 answer
2. The corneal structure poses three potential barriers to drug permeation to interior structures of the...
2. The corneal structure poses three potential barriers to drug permeation to interior structures of the eye. List and describe these three potential barriers....
1 answer
How do you factor #f(x)=x^3-12x^2+36x-32# completely, given that (x-2) is a factor?
How do you factor #f(x)=x^3-12x^2+36x-32# completely, given that (x-2) is a factor?...
1 answer
What is the price of a three-year zero coupon bond whose face value is $1,000 and...
What is the price of a three-year zero coupon bond whose face value is $1,000 and whose yield is 4%?...
1 answer
My assignment is to find quotes from thimas jefferson's query 14 and label them according to fallacies and i just dont get it
my assignment is to find quotes from thimas jefferson's query 14 and label them according to fallacies and i just dont get it. some quotes include"Comparing them by their faculties of memory, reason, and imagination, it appears to me, that in memory they are equal to the whites; in reason mu...
1 answer
How do you write the rule for the nth term given #1.9,2.7,3.5,4.3,5.1,...#?
How do you write the rule for the nth term given #1.9,2.7,3.5,4.3,5.1,...#?...
1 answer
In a high school graduating class of 100 students, 54 studied mathematics, 69 studied history, and...
In a high school graduating class of 100 students, 54 studied mathematics, 69 studied history, and 35 studied both mathematics and history. If one of these students is selected at random, find the probability that (a) the student took mathematics or history; (b) the student did not take either of th...
1 answer
Need help on these questions related to Fluid Mechanics. For the siphon shown below, assume frictionless...
Need help on these questions related to Fluid Mechanics. For the siphon shown below, assume frictionless flow, and dimension a (uniform diameter), in GPM? 6 feet; b-14 feet. Find the discharge in the 2-inch pipe al...