Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Choose Your Own Adventure There used to be a popular type of pulp book for younger readers. They were called Choose Your Own Adventure novels.

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Choose Your Own Adventure There used to be a popular type of pulp book for younger readers. They were called "Choose Your Own Adventure" novels. The idea was pretty simple. You'd start reading and then a few pages into the book, there would be a plot development that required a choice. The book might describe that you've entered a spooky house and the door has locked behind you. It would then ask you if you want to try to exit by going through the kitchen or exploring upstairs. If you chose to go into the kitchen, you'd turn to page 200, if you chose to go upstairs, you'd turn to page 43. This would repeat maybe five or six times though the book. You could re-read it a few times and try different outcomes. In principle this is the same as a bunch of statements. But the stories were never very personal. We can do a lot more. Your goal is to create a choose your own adventure story. Start off by asking the user a few questions and storing these in an object called us. That way you can always get the values from the user object. So in your story you can write something like: You see your best friend,+ user bestfriendisane walking down the street. After you've stored some information to personalize the story, print out a few lines of text. At each branch of the story ask the user a question that can be answered in a single word. Example: You are approaching broad street. Do you want to turn left or right? 18/modules Take the feedback andinsertto print out awamorelines of vorstervandithanaskatheriseraanother cuestion You are approaching broad street. Do you want to turn "left" or "right"> Take the feedback and use it to print out a few more lines of your story, and then ask the user another question. Use what you've learned about fase statements to provide new questions based on how the user answered the previous one. For extra credit, use loops to make sure that you don't get weird answers. So if the you need the user to choose to drive or walk and they type in "bus" you should re-prompt them with the same question and make sure they don't go on without a valid answer. This will need to be done for every question. It is a significant enhancement to the program Note: This assignment has an extra credit component. To earn extra credit you must first earn a perfect score on the base requirements for the assignment. Requirements Your story needs to have at least three (3) turning points. It can have more but no fewer. If the user answers three questions, this will result in eight (8) possible outcomes for your story. To keep from becoming confused you will have to keep your code well formatted and organized. You don't need to write a novel. A sentence or two between each question is totally fine. Three (3) questions must be asked no matter how the user answers the previous question. The story must have eight (8) possible different outcomes. The story must be printed out to the console. As usual, keep it safe for work. You must personalize the story using data asked from the user. Hint //copinstructure.com courses/161674B/assignments/9937571 Hint To understand this program, you must understand that when a condition in an "it" test fails, then the entire block is skipped and all the code that is contained in it will not be evaluated or run. If there is an associated "else" branch, then that code will be run instead. When the "if" condition is true, all the code in the "else" branch will be skipped and will not be evaluated or run. You should review this idea carefully and make sure it is clear to you before reading on... This program will require you to format your code carefully. Use indentation rules the way I have demonstrated in class and lecture notes. You will need to place if/else blocks within other if/else blocks for this program to work For example: if (firstAnswer 'left') { 1 Ask another question if (secondAnswer 'yes) 1/ Ask another question. else 11 Ask a different question. 3 } else { I ask a different questions 3 This example shows a single level of nesting. Your program must have two levels of nesting. In the simplest case, there should be a total of 7 ir keywords and 7 else keywords. Some general coding guidelines When creating loops and if/else blocks put the opening curly brace on the line that contains the beginning statement. Put all code in iftelse blocks or loops on another line (not on the line stating the block). The closing curly brace should be on a new line after any other code in the block - Profor Machanahan dalaman ta . /ccp instructe.com/courses/1616748/assignments/9937571 Some general coding guidelines When creating loops and 18/else, blocks put the opening curly brace on the line that contains the beginning statement. Put all code in /else blocks or loops on another line (not on the line stating the block) . The closing curly brace should be on a new line after any other code in the block. . Prefer -- to when checking for equality. Indent code within if statements and loops. Good example: if (name 'Bob') { console.log('Bob is cool } else console.log('You are not cool); ) while (bobice go around You go around the bus only to see a subway entrance. Do you go in" or "keep running"? There is a zoo keeper in the subway. He captures the tiger and you are saved. The End But then if you ran it again it might do this... Enter your favorite color: red Enter your favorite food: apples Enter your favorite animal: tiger You are walking down the street eating some apples when a red tiger runs up and takes your lunch and then runs away. Do you want to "chase the tiger or run away" > chase The tiger makes a runs towards downtown. You need to prevent it from attacking people in the crowd. Do you call the " ire department the police ructure.com/courses/1616748/assignments/9937571 Conditionals Rubric Criteria Ratings Pts Story has three turning points. O pts 6 pts Full Marks No Marks 6 pts Proper use of nested if/else statements. 4 pts Full Marks O pts No Marks 4 pts Code quality and cleanliness. 2 pts Full Marks O pts No Marks 2 pts Program output and formatting. 2 pts Full Marks O pts No Marks 2 pts User object to hold personal details. 6 pts Full Marks O pts No Marks 6 pts Extra credit Use of loops to prevent invalid input. O pts 4 pts Full Marks No Marks 4 pts Total Points: 24

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_2

Step: 3

blur-text-image_3

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

Find the investors expected profit.

Answered: 1 week ago

Question

is the work rate in the sub max bike test the heart rate

Answered: 1 week ago