Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in Swift programming language In this lab we are going to create a game that uses all the different types of control flow operators that

in Swift programming language

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

In this lab we are going to create a game that uses all the different types of control flow operators that exist in Swift. The game will be a choose your own adventure game. The user will have to answer a series of questions and this will change the path of a story. This must be done by using if/else statements that are nested within other if/else statements. Your story must have four (4) different possible endings. Beyond this, you must provide some setup for the story to provide customized messages. Ask the user questions that will be used to capture details for use within the story. Ask the user at least one question that has them choose something from a list of possible values and use a switch to set the appropriate variable. Ask the user at least one question that results in a numeric range and use an interval switch to set another variable. Also ask the user a binary (yeso or true/false) question. Use the answer from this in a ternary to store another variable. Use these variables within the output of the messages to the user in the story. When you are done, set a break point in your program at the first line. Use Xcode to walk through each line of the code while you play the game. Use the tools of Xcode to check the values of the various variables after they are set. Use Quicktime to create a screen recording (no sound needed) of this process and hand this in as part of the submission. The video should be only one or two minutes long. Requirements You must customize the story using at least one ternary You must customize the story using at least one switch You must customize the story using at least one interval switch You must have at least three (3) if/else structures. There should be an if/else nested within each branch of an if/else statement in order to provide at least 4 different endings to the story. The story must have four (4) different possible endings. Answering any question the opposite way must result in the next question being different on subsequent runs of the program. Keep your story clean and professional in theme and tone (see the syllabus rules of conduct for clarification on this if you are confused). Submit a video screen recording of your use of the step debugger as described above. . Example Program Output Here is an example of a how the program might work... Example Program Output Here is an example of a how the program might work... Enter your favorite color? Pick "red", "orange", "yellow", "green", or "blue" > red Do you like apples? "Yes" or "No"? > Yes How fast can you run a mile? Enter as a decimal number. > 8.5 You are walking down the street eating some apples when a red tiger runs up and takes your lunch and then quickly runs away. Do you want to "chase" the tiger or "run away"? > run away You run away from the tiger but it is a bad idea to run from an animal. It turns and decides to try to eat you. Y ou see a bus blocking your path up ahead. Do you "get on" the bus or "go around"? > go around There is a zoo keeper on the other side of the bus only to see a subway entrance. He captures the tiger and you a re saved. The End. But then if you ran it again it might do this... Enter your favorite color? Pick "red", "orange", "yellow", "green", or "blue" > green Do you like apples? "Yes" or "No"? > No How fast can you run a mile? Enter as a decimal number. > 20 You are walking down the street eating some oranges when a green tiger runs up and takes your lunch and then walk S away. Do you want to "chase" the tiger or "run away"? > chase The tiger runs but falls into the river. Do you "help it" or "leave it"? > help it You save the tiger and it is grateful. You have a new pet. The End Note that the initial story changes depending on the numbers and other information you've entered. Also note that the second question is different depending on the answer to the first question. Control Flow Lab Rubric Criteria Ratings Pts Use of ternary. 3 pts Full Marks O pts No Marks 3 pts Use of switch. 3 pts Full Marks O pts No Marks 3 pts Use of interval switch. 3 pts Full Marks O pts No Marks 3 pts Nested if/else blocks. 4 pts O pts Full Marks No Marks 4 pts Minimum of three if/else blocks. 2 pts Full Marks O pts No Marks 2 pts Code Quality 2 pts Full Marks O pts No Marks 2 pts Debugging video. 3 pts Full Marks O pts No Marks 3 pts Total Points: 20 In this lab we are going to create a game that uses all the different types of control flow operators that exist in Swift. The game will be a choose your own adventure game. The user will have to answer a series of questions and this will change the path of a story. This must be done by using if/else statements that are nested within other if/else statements. Your story must have four (4) different possible endings. Beyond this, you must provide some setup for the story to provide customized messages. Ask the user questions that will be used to capture details for use within the story. Ask the user at least one question that has them choose something from a list of possible values and use a switch to set the appropriate variable. Ask the user at least one question that results in a numeric range and use an interval switch to set another variable. Also ask the user a binary (yeso or true/false) question. Use the answer from this in a ternary to store another variable. Use these variables within the output of the messages to the user in the story. When you are done, set a break point in your program at the first line. Use Xcode to walk through each line of the code while you play the game. Use the tools of Xcode to check the values of the various variables after they are set. Use Quicktime to create a screen recording (no sound needed) of this process and hand this in as part of the submission. The video should be only one or two minutes long. Requirements You must customize the story using at least one ternary You must customize the story using at least one switch You must customize the story using at least one interval switch You must have at least three (3) if/else structures. There should be an if/else nested within each branch of an if/else statement in order to provide at least 4 different endings to the story. The story must have four (4) different possible endings. Answering any question the opposite way must result in the next question being different on subsequent runs of the program. Keep your story clean and professional in theme and tone (see the syllabus rules of conduct for clarification on this if you are confused). Submit a video screen recording of your use of the step debugger as described above. . Example Program Output Here is an example of a how the program might work... Example Program Output Here is an example of a how the program might work... Enter your favorite color? Pick "red", "orange", "yellow", "green", or "blue" > red Do you like apples? "Yes" or "No"? > Yes How fast can you run a mile? Enter as a decimal number. > 8.5 You are walking down the street eating some apples when a red tiger runs up and takes your lunch and then quickly runs away. Do you want to "chase" the tiger or "run away"? > run away You run away from the tiger but it is a bad idea to run from an animal. It turns and decides to try to eat you. Y ou see a bus blocking your path up ahead. Do you "get on" the bus or "go around"? > go around There is a zoo keeper on the other side of the bus only to see a subway entrance. He captures the tiger and you a re saved. The End. But then if you ran it again it might do this... Enter your favorite color? Pick "red", "orange", "yellow", "green", or "blue" > green Do you like apples? "Yes" or "No"? > No How fast can you run a mile? Enter as a decimal number. > 20 You are walking down the street eating some oranges when a green tiger runs up and takes your lunch and then walk S away. Do you want to "chase" the tiger or "run away"? > chase The tiger runs but falls into the river. Do you "help it" or "leave it"? > help it You save the tiger and it is grateful. You have a new pet. The End Note that the initial story changes depending on the numbers and other information you've entered. Also note that the second question is different depending on the answer to the first question. Control Flow Lab Rubric Criteria Ratings Pts Use of ternary. 3 pts Full Marks O pts No Marks 3 pts Use of switch. 3 pts Full Marks O pts No Marks 3 pts Use of interval switch. 3 pts Full Marks O pts No Marks 3 pts Nested if/else blocks. 4 pts O pts Full Marks No Marks 4 pts Minimum of three if/else blocks. 2 pts Full Marks O pts No Marks 2 pts Code Quality 2 pts Full Marks O pts No Marks 2 pts Debugging video. 3 pts Full Marks O pts No Marks 3 pts Total Points: 20

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analytics Systems Engineering Cybersecurity Project Management

Authors: Christopher Greco

1st Edition

168392648X, 978-1683926481

More Books

Students also viewed these Databases questions

Question

what was the regulation in the Motor Carrier Act (1935)

Answered: 1 week ago

Question

Describe the factors influencing of performance appraisal.

Answered: 1 week ago

Question

What is quality of work life ?

Answered: 1 week ago

Question

What steps should be taken to address any undesirable phenomena?

Answered: 1 week ago