Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Note These exercises reinforce Swift concepts in the context of a fitness tracking app. You think it might be fun to incorporate some friendly competition
Note These exercises reinforce Swift concepts in the context of a fitness tracking app. You think it might be fun to incorporate some friendly competition into your fitness tracking app. Users will be able to compete with friends in small fitness challenges. However, to do this users will need a password-protected account. Write an if-else statement below that will check that the entered user name and password match the stored user name and password. While the password should be case sensitive, users should be able to log in even if their entered user name has the wrong capitalization. If the user name and password match, print "You are now logged in!" Otherwise, print "Please check your user name and password and try again." 8 let storedUserName"TheFittest11" 9 let storedPassword"a8H1LuK91 10 let enteredUserName "thefittest11" 11 let enteredPassword: String = "a8H1Luk9" 12 13 Now that users can log in, they need to be able to search through a list of users to find their friends. This might normally be done by having the user enter a name, and then looping through all user names to see if a user name contains the search term entered. You'll learn about loops later, so for now you'll just work through one cycle of that. Imagine you are searching for a friend whose user name is StepChallenger. You enter "step" into a search bar and the app begins to search. When the app comes to the user name "stepchallenger," it checks to see if "StepChallenger" contains "step." Using userName and searchName below, write an if-else statement that checks to see if userName contains the search term. The search should not be case sensitive. 19 import Foundation 20 let userNameStepChallenger" 21 let searchName"step" 23 Note These exercises reinforce Swift concepts in the context of a fitness tracking app. You think it might be fun to incorporate some friendly competition into your fitness tracking app. Users will be able to compete with friends in small fitness challenges. However, to do this users will need a password-protected account. Write an if-else statement below that will check that the entered user name and password match the stored user name and password. While the password should be case sensitive, users should be able to log in even if their entered user name has the wrong capitalization. If the user name and password match, print "You are now logged in!" Otherwise, print "Please check your user name and password and try again." 8 let storedUserName"TheFittest11" 9 let storedPassword"a8H1LuK91 10 let enteredUserName "thefittest11" 11 let enteredPassword: String = "a8H1Luk9" 12 13 Now that users can log in, they need to be able to search through a list of users to find their friends. This might normally be done by having the user enter a name, and then looping through all user names to see if a user name contains the search term entered. You'll learn about loops later, so for now you'll just work through one cycle of that. Imagine you are searching for a friend whose user name is StepChallenger. You enter "step" into a search bar and the app begins to search. When the app comes to the user name "stepchallenger," it checks to see if "StepChallenger" contains "step." Using userName and searchName below, write an if-else statement that checks to see if userName contains the search term. The search should not be case sensitive. 19 import Foundation 20 let userNameStepChallenger" 21 let searchName"step" 23
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started