Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this assignment you will create a short text-based adventure game. The user i

ID: 3530495 • Letter: I

Question

In this assignment you will create a short text-based adventure game. The user is presented with a short text description of the state of the game and a small set of alternative actions to take. Based on the user's response your program will present a different game state. This continues until the game ends; there may be several possible endings with different degrees of success. The text of the game state and the alternatives are provided in a table below. In each case where an input is given by the user, "other" denotes any number other than those explicitly listed in that action. Functional requirements: 1. The results of the user's actions should be clear; make sure you use whitespace to separate the list of alternative actions from the description of the next game state. 2. Each time the user acquires or loses an object, (such as the purse) you must print a message about the object before describing the next game state. Grading rubric (described here): Performance Indicator [1] [2] [3] Readability and documentation 1 2 2 Use of conditional operators 1 2 2 Functional requirements 2 3 4 Non-functional requirements 1 2 2

Explanation / Answer

You have written the full question.However i have done that before...

-----------------------------------------------------

import java.util.Scanner;

public class EasyGame

{ /** * @param args */

public static void main(String[] args)

{ // TODO Auto-generated method stub

Scanner input= new Scanner(System.in);

int state = 1,res;

boolean coin, purse = true, horse=true;

//Text description

if (state==1)

{

System.out.println("Sir Hero, you have just left your castle gate in search of adventure.");

System.out.println("You begin the journey with a horse, a sword, and a purse of coins.");

System.out.println("Along the road you meet a decrepit old man who offers you a gold coin.");

System.out.println("What do you do? ");

System.out.println("1. Accept coin, add it to your purse " +"2. Decline coin, but give the generous old man all your money " +"Other: Ignore the man and ride on ");

System.out.println("Enter an integer: ");

res = input.nextInt();

if(res==1)

{

System.out.println("When you return to your castle you find that your serfs are very disappointed");

System.out.println("in your lack of heroism; they kick you out of the castle and install a new knight");

System.out.println("in your place. You turn to turnip farming. ");

System.exit(1);

}

if(res==2)

{

System.out.println("Decline the coin, but give the generous old man all of your money");

System.out.println("You have lost the purse. ");

System.out.println("A mile past the old man a wandering grue menaces you with its fearsome claws.");

System.out.println("Grue are well known to be immune to the cut of a sword. What do you do? ");

System.out.println("1: Attack the grue with your something other than your sword");

System.out.println("2: Attack the grue with your sword "+"3: Ride past the grue "+"other: Turn back to your castle ");

System.out.println("Enter an integer: ");

res = input.nextInt();

}

if(res==3)

{

System.out.println("A mile past the old man a wandering grue menaces you with its fearsome claws.");

System.out.println("Grue are well known to be immune to the cut of a sword. What do you do? ");

System.out.println("1: Attack the grue with your something other than your sword");

System.out.println("2: Attack the grue with your sword "+"3: Ride past the grue "+"other: Turn back to your castle ");

System.out.println("Enter an integer: ");

res = input.nextInt();

}

}

if(state==2)

{

System.out.println("A mile past the old man a wandering grue menaces you with its fearsome claws.");

System.out.println("Grue are well known to be immune to the cut of a sword. What do you do? ");

System.out.println("1: Attack the grue with your something other than your sword");

System.out.println("2: Attack the grue with your sword "+"3: Ride past the grue "+"other: Turn back to your castle ");

System.out.println("Enter an integer: ");

res = input.nextInt();

if (res==1)

{

System.out.println("You rush to attack the grue, grabbing the only other weapon at hand, your coin purse.");

System.out.println("Your blows have no effect. The grue slashes at you but hits the coin purse, spilling gold");

System.out.println("coins everywhere. The grue gathers the coins and ignores you. ");

System.out.println("You rush to attack the grue with you bare hands, and it swallows you whole. You have died.");

return;

}

if(res==2)

{

System.out.println("The grue swallows you, sword and all. You have died.");

return;

}

if(res==3)

{

System.out.println("The grue leaps after you, taking down your noble steed from behind.");

System.out.println("You sneak away while it eats your horse.");

}

}

}

-------------------------------------------------

http://www.chegg.com/homework-help/questions-and-answers/question-q3765703