Making Decisions with If Statements


 import java.util.Scanner;

public class adv
{
    public static void main( String[] args)
    {
        Scanner keyboard = new Scanner(System.in);
        
        int ans1;
        int ans2;
        int ans3;
        
        System.out.println("Welcome to my story. Let's see if you make it out alive :)");
        System.out.println("answer with either 1 or 2");
        System.out.println("Let's begin. You're walking into a store on a day, but this day isn't your average day. It's Black Friday. When you walk into the stone, you see the tv that you've always wanted for 70% off. When you get to the tv, a man grabs the tv. Do you grab the tv or do you walk away?");
        System.out.println(" 1: That tvs mine!");
        System.out.println(" 2: Violence is never the answer");
        System.out.println();
        ans1 = keyboard.nextInt();
        
        
        if ( ans1 == 1 )
         {
             System.out.println( "Congrats. You got yourself into a fight. You are the true meaning of Black Friday. So the man says' if you don't let go of this tv, im gonna shank you'. What do you respond with?" );
         System.out.println(" 1: Come at me bruh!");
         System.out.println(" 2: Na, i like my insides all nice and not stabbed");
         System.out.println();
         ans2 = keyboard.nextInt();
        
        if ( ans2 == 1 )
         {
             System.out.println( "The fight begins. He comes at you with the knife. As he's coming at you, a woman with the biggest cart ever flys down the isle, completely flattening the man. You have the tv and get to pay only 40% of the asking price. Victory comes to those who play their card right." );
         }
         else if ( ans2 == 2 )
         {
             System.out.println( "You back off. While walking down the isle, a lady flys down the isle with a cart full of stuff, like she couldn't get enough. She trips, the cart comes towards you, and you get flattened." );
             System.out.println("You died.");
         }    
             
         }
         
        
        
        else if ( ans1 == 2 )
         {
             System.out.println( "Because you backed off, you head to another part of the store, the kitchen area. There is a 90% sale on all knives. Do you head into the the crowd in the knife isle?" );
             System.out.println(" 1: Let's get me a knife!");
             System.out.println(" 2: That looks dangerous. That would be a giant no");
             System.out.println();
             ans3 = keyboard.nextInt();
            
         if ( ans3 == 1 )
         {
             System.out.println( "You step into the knife isle and an earthquake hits (this is california after all), and a knife falls and stabs you in the foot, pinning you to the floor. While in pain, a giant monitor on the ceiling reading 'Safety Comes First' falls and crushes you. Ironic, isn't it." );
             System.out.println("You died");  
         }
         else if ( ans3 == 2)
         {
             System.out.println( "Well, you kinda wussed out of all the danger of Black Friday. This could have been a lot funner if you actually took some risks. You know what, because you wussed out, congrats, you died. Lets just just say you died from wussidis. Dissapointing." );

        
        }
    }
}
}
    

Picture of the output

Assignment 46