Project 1

Code

   
    /// Name: Afaf Nabeeha
    /// Period: 7
    /// Program Name: Project 1
    /// File Name: Project.java
    /// Date Finished: 1/20/2016 public class Project
      
      
        import java.util.Scanner;
        public class Project
        {
            public static void main( String[] args )
            {
                Scanner keyboard = new Scanner(System.in);
                String a1, a2, a3;
                a1 = "a";
                a2 = "b";
                a3 = "c";
                System.out.println( "WELCOME AFAF'S TINY ADVENTURE 2!!" );
                System.out.println( "You are walking in downtown Walnut Creek! Would you like to go \"eat\", \"shop\", or \"stroll\"? " );
                System.out.print( "> " );
                a1 = keyboard.next();
                System.out.println();
                
                if ( a1.equals("eat") )
                {
                    System.out.println( "You see two places where you could eat, the Cheesecake Factory, and a sketchy-looking diner . Would you like to go into the \"Factory\" or the \"diner\" " );
                    System.out.print( "> " );
                    a2 = keyboard.next();
                    if ( a2.equals("Factory") )
                    {
                        System.out.println( "Would you like to \"eat outside\" or \"eat inside\"?" );
                        System.out.print( "> " );
                        a3 = keyboard.nextLine();
                        if ( a3.equals("eat outside") )
                        {
                            System.out.println( "As soon as the waiter serves you your steaming plate of food, lightning flashes.  10 seconds later, you find that you and your expensive food are both drenched. " );
                        }
                        else if ( a3.equals("eat inside") )
                        {
                            System.out.println( "You are seated next to a family with young childeren.  By the time you finish your meal, you have baby food on your shirt. " );
                        }
                    }
                    else if ( a2.equals("diner") )
                    {
                        System.out.println( "The diner is dim and has very few people actually eating.  There are much more people heading into the basement, where you can hear what sounds like complete chaos. You are curious, but also very hungry.  Would you like to \"eat\" or \"go downstairs\"? " );
                        System.out.print( "> " );
                        a3 = keyboard.next();
                        if ( a3.equals("eat") )
                        {
                            System.out.println( "The food is surprisingly good, even though the waitress didn't bring you the right meal.  I guess you'll never know what is in the basement " );
                        }
                        else if ( a3.equals("go downstairs") )
                        {
                            System.out.println( "You descend the stairs and are shocked to see that it is a luxurious club.  You are surrounded by actors, models, and singers.  A modeling agent sees you watching the scene with awe and is astounded by your amazing looks.  Withing a month, you are the biggest celebrity in Hollywood." );
                        }
                    }
                }
                else if ( a1.equals("shop") )
                {
                    System.out.println( "You see your favorite stores and beam with excitement. You are dying to go to H&M, but then you see an awesome outfit in the window of a not-so popular store." );
                    System.out.println( "Would you like to go to \"H&M\" or \"the other store\" " );
                    System.out.print( "> " );
                    a2 = keyboard.next();
                    if ( a2.equals("H&M" ) )
                    {
                        System.out.println( "You enter H&M and see some awesome Holiday clothes, but then spot a clearance sign in the back.  As a somewhat poor high school kid, you are torn between money and Holiday happiness.  Do you want to get \"Holiday\" clothes or scour the \"clearance\" rack? " );
                        System.out.print( "> ");
                        a3 = keyboard.next();
                        if( a3.equals("Holiday") )
                        {
                            System.out.println( "You blow your money on a super ugly Holiday sweater. " );
                        }
                        else if (a3.equals("clearance") )
                        {
                            System.out.println( "You find some awesome deals, and you can buy clothes for everyone in your family. Maybe now your parents will get you a car." );
                        }
                    }
                    else if (a2.equals("the other store") )
                    {
                        System.out.println( "You open the door and peer around. Its not too shabby." );
                        System.out.println( "Would you like to \"look around\" or just grab the outfit and \"leave\"? " );
                        a3 = keyboard.next();
                        if (a3.equals("look around"))
                        {
                            System.out.println( "This is now secretely your favorite store.  It has literally everything and its cheap.  Boo-yah! " );
                        }
                        else if (a3.equals("leave") )
                        {
                            System.out.println( "You make it home in time for family game night.  Great. " );
                        }
                    }
                }
                else if ( a1.equals("stroll") )
                {
                    System.out.println( "Would you like to go \"straight\" or \"turn right\"? " );
                    System.out.print( "> " );
                    a2 = keyboard.next();
                    if (a2.equals("straight") )
                    {
                        System.out.println( "You bump into your lifelong crush. Do you want to \"talk\" or \"say sorry\" and move on? " );
                        System.out.print( "> " );
                        a3 = keyboard.next();
                        if (a3.equals("talk") )
                        {
                            System.out.println( "You fall in love and live happily ever after. " );
                        }
                        else if (a3.equals("say sorry") )
                        {
                            System.out.println( "50 years later, you find yourself living alone with a bunch of cats." );
                        }
                    }
                    else if (a2.equals("turn right") )
                    {
                        System.out.println( "You see a friend from school and don't really want to talk to them.  Do you \"chat\" or \"ignore\" them and keep walking? " );
                        System.out.print( "> " );
                        a3 = keyboard.next();
                        if (a3.equals("chat") )
                        {
                            System.out.println( "They remind you about a english test that you didn't study for.  You hug them and run home.  Study hard! " );
                        }
                        else if (a3.equals("ignore") )
                        {
                            System.out.println( "The guilt from not talking to them eats at you.  Sigh... " );
                        }
                    } 
                }
            }
        }


    

Picture of the output

Assignment P1