Question

reinforce swift concept context of fitness tracking app

****** 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
0 0
Add a comment Improve this question Transcribed image text
Answer #1

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!

Add a comment
Know the answer?
Add Answer to:
reinforce swift concept context of fitness tracking app
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • App Exercise -Workout Types Note These exercises reinforce Swift concepts in the context of a fitness tracking app...

    App Exercise -Workout Types Note These exercises reinforce Swift concepts in the context of a fitness tracking app. You fitness tracking app may allow users to track different kinds of workouts. When architecting the app types of workout dasses inherit. Below are three classes. Workout igthe base class with time and distance properties, and Run and Swim are subclasses that add more specific properties to the Workout class. you may decide to have a Workout base class from which other...

  • App Exercise -Workout Types Note These exercises reinforce Swift concepts in the context of a fitness...

    App Exercise -Workout Types Note These exercises reinforce Swift concepts in the context of a fitness tracking app. You fitness tracking app may allow users to track different kinds of workouts. When architecting the app types of workout dasses inherit. Below are three classes. Workout igthe base class with time and distance properties, and Run and Swim are subclasses that add more specific properties to the Workout class. you may decide to have a Workout base class from which other...

  • Hello, this is my study guide for my final test, please help me find the right...

    Hello, this is my study guide for my final test, please help me find the right answers to them. QUESTION 1 The epiglottis directly covers the glottis found inside the larynx. True False QUESTION 2 The trachea connects to the lungs. True False QUESTION 3 The glottis blocks the opening to the respiratory passage during swallowing. True False QUESTION 4 Inhaled air goes directly into the nasopharynx. True O False QUESTION 5 Residual lung air volume is the amount of...

  • Using Jupyter, Please answer the following question: Please import alic.txt and cound the number of words...

    Using Jupyter, Please answer the following question: Please import alic.txt and cound the number of words and characters in it. We need to count the number of words in the txt file and find the most repeated one. In the program, first convert all words to lower case and then convert the first character to the upper case. Then we need to do the analysis. We are not interested in the following words: The, A, And, To, It alice.txt file:...

  • 4. Perform a SWOT analysis for Fitbit. Based on your assessment of these, what are some strategic options for Fitbit go...

    4. Perform a SWOT analysis for Fitbit. Based on your assessment of these, what are some strategic options for Fitbit going forward? 5. Analyze the company’s financial performance. Do trends suggest that Fitbit’s strategy is working? 6.What recommendations would you make to Fitbit management to address the most important strategic issues facing the company? Fitbit, Inc., in 2017: Can Revive Its Strategy and It Reverse Mounting Losses? connect ROCHELLE R. BRUNSON Baylor University MARLENE M. REED Baylor University in the...

  • While reading the story, consider the culture (or sub culture) and related communication styles the story...

    While reading the story, consider the culture (or sub culture) and related communication styles the story reveals. Consider too, possibly, the values, behavioral norms, social practices, social artifacts, etc. After reading the story through the lens of this idea, please compose a full academic length (evidence-based 7 to 11 sentence long) paragraph which addresses the following prompt: What does the story reveal about the culture it portrays and/OR the communication styles the culture shares? In other words, what does the...

  • please use python and provide run result, thank you! click on pic to make it bigger...

    please use python and provide run result, thank you! click on pic to make it bigger For this assignment you will have to investigate the use of the Python random library's random generator function, random.randrange(stop), randrange produces a random integer in the range of 0 to stop-1. You will need to import random at the top of your program. You can find this in the text or using the online resources given in the lectures A Slot Machine Simulation Understand...

  •    Available Feb 11 at 12am - Mar 8 at 11:59pm 26 days Not for IV...

       Available Feb 11 at 12am - Mar 8 at 11:59pm 26 days Not for IV Use: The Story of an Enteral Tubing Misconnection The Story of Robin and Addison Lowe (United States) LEARNING OBJECTIVES After completing this case study, you will be able to: 1. Explore the scientific feld of human factors and how errors like tubing misconnections can be prevented. 2. Discuss the complexity of having two patients to treat, a mother and her fetus. 3. Describe suitable...

  • Read the attached article and answer the following questions. 1. What is the role of potassium...

    Read the attached article and answer the following questions. 1. What is the role of potassium in blood pressure? 2. Looking back at last weeks Super Tracker report - do you meet the 4700mg daily target for potassium? 3. Do you meet the 400mg daily target for magnesium? 4. Research shows that hypertension and type 2 diabetes can be prevented by dietary choices. List 3 ways that employers, government, doctors, etc. (you can use another group ) can either motivate...

  • How does this article relate to the factors of productions in economics? From Music to Maps,...

    How does this article relate to the factors of productions in economics? From Music to Maps, How Apple’s iPhone Changed Business Ten years ago, hailing a cab meant waiving one's arm at passing traffic, consumers routinely purchased cameras, and a phone was something people made calls on. The iPhone, released a decade ago this month, changed all of that and more, sparking a business transformation as sweeping as the one triggered by the personal computer in the 1980s. Apple Inc.'s...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT