Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you are going to write a short decision-based game is an interactive program where a narrator describes a situation for the user

In this assignment you are going to write a short decision-based game is an interactive program where a narrator describes a situation for the user with several options each option results in different outcomes.
Instructions: in your program there should be at least one situation and at least three options for the user to choose that change the outcome of the situation. image text in transcribed
image text in transcribed
image text in transcribed
In this assignment, you are going to write a short decision-based game. A decision-based game is an interactive program where a narrator describes a situation for the user and provides the user with several options. Each option results in different outcomes. Instructions 1. In your program, there should be at least one situation and at least three options for the user to choose that change the outcome of the situation Example 1 import java.util.Scanner; 2. public class StoryGame { public static void main(String args) { Scanner input = new Scanner(System.in); String situationi - "You are locked in a prison cell with a fellow prisoner. + "A guard tells you two that the winner of a game of rock-paper-scissors will be let free: string options1 = "Please type your choice ( for rock; 1 for paper: 2 for scissors": system.out.println(situation1): System.out.print(options1); int selectedoption input.nextInt(); 11(selectedoption - 0) { System.out.println("The prisoner chose paper! The guard lets the prisoner out free."); } else if(selectedoption == 1) ( System.out.println("The prisoner chose paper too! It's a draw. The guard laughs at both + "of you and walks away, no one is set free"); } else if(selectedoption == 2) { System.out.println("The prisoner chose paper! The guard lets you out free!"); Output Console Problems Debug Shell terminated storyGame Cava Application/app/opend 11/bin/java (Feb 22, 2021, 43951 PM - 10:57 PM) You are locked in a prison cell with a fellow prisoner. A guard tells you two that the winner of a game of rock-paper-scissors will be let free. Please type your choice for rock: 1 for paper: 2 for scissors ) The prisoner chose paper! The guard lets the prisoner out free. G Search or type URL Console R Problems Debug Shell terminated story Game Data Application/app/openjdk-11/binja (Feb 22, 2071,44036 PM - 10:30 PM You are locked in a prison cell with a fellow prisoner. A guard tells you two that the winner of a game of rock-paper-scissors will be let free. Please type your choice for rock; 1 for paper: 2 for scissors 11 The prisoner Chose paper too! It's a draw. The guard laughs at both of you and walks away, no one is set free Console R Problems Debug Shell terminated storyGames Application/app/openjdk-11/bin/java (Feb 22, 2021, 434120 PM - 4:41:23 PM You are locked in a prison cell with a fellow prisoner. A guard tells you two that the winner of a game of rock-paper-scissors will be let free Please type your choice for rock; 1 for paper: 2 for scissors 12 The prisoner chose paper! The guard lets you out free

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions