TwoQues

Code

  import java.util.Scanner;
  
  public class TwoQues
  {
      public static void main( String[] args )
      {
          Scanner keyboard = new Scanner(System.in);
          
          String a, b;
          
          System.out.println( " Is it animal, vegetable, or mineral? ");
          a = keyboard.next();
          
          if ( a.equals("animal"))
          {
              System.out.println( " Is it bigger than a dog ");
          }
          else if ( a.equals("vegetable"))
          {
              System.out.println( " Is it bigger than a dog ");
          }
          else if ( a.equals("mineral"))
          {
              System.out.println( " Is it bigger than a dog ");
          }
          System.out.println( " yes or no" );
          b = keyboard.next();
          
          if ( a.equals("animal") && b.equals("yes"))
          {
              System.out.println( " so its a dog " );
          }
          else if ( a.equals("animal") && b.equals("no"))
          {
              System.out.println( " its a mouse " );
          }
          else if ( a.equals("vegetable") && b.equals("yes"))
          {
              System.out.println( " i don't want to know" );
          }
          else if ( a.equals("vegetable") && b.equals("no"))
          {
              System.out.println( " carrots? " );
          }
          else if ( a.equals("mineral") && b.equals("yes"))
          {
              System.out.println( " mountains? " );
          }
          else if ( a.equals("mineral") && b.equals("no"))
          {
              System.out.println( " pebbles " );
          }
          
      }
  }

TwoQues

Assignment 44