Question
Create a new Swift playground to track survey data about Muni riders, and output a summary of the data to the debug area. First, declare
Create a new Swift playground to track survey data about Muni riders, and output a summary of the data to the debug area. First, declare the following variables at the top of your playground: var lineSurveyed = "K-Ingleside" var daysSurveyed = 5 var passengers = 123456 Your playground should first print out these three variables to the debug area. Then, it divides the number of passengers by the number of days and outputs the resulting average daily ridership to the debug area. If that average is not a whole number, make sure you show the decimal value (such as in the examples below). You should use a typecast to make this work. The precision, i.e. the number of digits after the decimal place, is not important. Finally, print out one (and only one!) of the following messages to the debug area: - if the average riders per day is less than 5000, print out that ridership is low - if the average riders is greater than or equal to 5000 but less than 15000, print out that ridership is average - if the average riders is greater than or equal to 15000, print out that ridership is high As an example, your playground should have the below in the debug area for the variables above. Welcome to the Muni Ridership Calculator. Line surveyed: K-Ingleside Days surveyed: 5 Passengers counted: 123456 According to the survey, an average of 24691.2 people rode per day. We have high ridership. I should be able to change the values of your variables at the top of your playground and get updated results. For example, if I change them as follows: var lineSurveyed = "N-Judah" var daysSurveyed = 30 var passengers = 250000 I should get the following output: Welcome to the Muni Ridership Calculator. Line surveyed: N-Judah Days surveyed: 30 Passengers counted: 250000 According to the survey, an average of 8333.33 people rode per day. We have average ridership.
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