Assignemnt #40

Code

  /// Name: Sam Wilson
  /// Period: 6
  /// Program Name: adventure
  /// File Name: adventure.java
  /// Date Finished: 10/18/2015

       import java.util.Scanner;
    
    public class adventure
    {
        public static void main(String[] args)
        {
            Scanner keyboard = new Scanner(System.in);
            
            String r1="", r2="", r3="",r4="", r5="", r6="", r7="";
            
                    System.out.println( "   Interactive Adventure Game" );
            System.out.println();
            System.out.println( "You wake up in a forest wearing only a tracksuit with no recollection whatsoever, do you go forward towards the cabin.");
            System.out.println("  ( yes = (y) or no = (n) )");
            System.out.print( "> " );
            r1 = keyboard.next();
            System.out.println("");
            
           
            if ( r1.equals("yes") )
            {
                System.out.println( "You walk in there's an upstairs and downstairs, you hear an odd moan from upstairs");
                System.out.println("Do you go up or down?");
                System.out.print( "> " );
                r2 =keyboard.next();
                System.out.println( "" );
                
                if ( r2.equals("up"))
                {
                    System.out.println("You see an oldman mumbling under his breathe you look to the right and see a crowbar");
                    System.out.println("you can either attack the old man with a crowbar or get to closer to here what he's saying");
                    System.out.println("(attack or listen)");
                    System.out.print( "> " );
                    r4 =keyboard.next();
                     System.out.println( "" );
                }
                    if ( r4.equals("listen"))
                       
                    {
                        System.out.println( "The old man tells you his life story in one minute to thank you for listening he tells you you can have his entire chest of treasure you leave a richman, you never find out who you are, but who cares you're rich!");
                    }
                    else if ( r4.equals("attack"))
                       
                    {
                        System.out.println("Why the hell would you attack an old man!? The police arrive in the minute and take you to jail for 1st degree murder.");
                    }
            }
               
            
                else if ( r2.equals("down"))
                {
                    System.out.println( "You're stomache rumbles furiously as you spot a freshly baked pie do you eat the pie or throw it out?");
                    System.out.println("(eat or toss)");
                    System.out.print( "> " );
                    r5 =keyboard.next();
                    System.out.println("");
                }
                        if ( r5.equals("eat"))
                        {
                            System.out.println("The pie had tons of acid in it, you trip balls for the rest of you life and live on the streets as a crazy homeless man" );
                        }
                        else if ( r5.equals("toss"))
                        {
                            System.out.println("You die of starvation after a couple of hours due to your eating disorder" );
                        }   
            
            else if( r1.equals("no"))
            {
                System.out.println("You head in the opposite direction for a couple of miles after a little while you see a strip club and a Bates Motel" );
                System.out.println("(motel or club)");
                System.out.print( "> " );
                r3 =keyboard.next();
                System.out.println("");
            }
                if ( r3.equals("club"))
                {
                    System.out.println("Everyone in the bar is wearing a suit and looks Italian, do you ask for a dance anyways or leave");
                    System.out.println("( leave or ask )");
                    System.out.print( "> " );
                    r6 =keyboard.next();
                    System.out.println("");
                }
                    if ( r6.equals("leave"))
                    {
                        System.out.println("As you leave you see someone running toward you apparently you hit your head on a run and were lost. You get to go home to your beautiful wife!");
                    }
                    else if (r6.equals("ask"))
                    {
                        System.out.println("You hear a loud bang and look down. You're gushing blood, it turns out this strip club is actually an Italian mob meet up spot, you die");
                    }
                
                else if ( r3.equals("motel"))
                {
                    System.out.println("The owner asks you if you want to rent a room or go back into the back for the other service");
                    System.out.println("(back or room)");
                    System.out.print( "> " );
                    r7 =keyboard.next();
                    System.out.println("");
                }
                        if ( r7.equals("back"))
                        {
                            System.out.println("It's a puppy petting service! As you pet puppies the other man in the room runs over to and says he knows you, the man takes you home to your beautiful wife");
                        }
                        else if ( r7.equals("room"))
                        {
                            System.out.println("C'mon man haven't you seen Pyscho!? Anyways you end up getting knifed in the shower and die.");
                        }
          
    }
    }

    

Picture of the output

Assignment 31