Program #47

Code

   
    /// Name: Afaf Nabeeha
    /// Period: 7
    /// Program Name: Two More Questions
    /// File Name: TwoMore.java
    /// Date Finished: 11/17/2015 public class TwoMore

            import java.util.Scanner;
            public class TwoMore
            {
                public static void main( String[] args )
                {
                    Scanner keyboard = new Scanner(System.in);
                    String place, status, thing;
                    thing = "a";
                    System.out.println( "TWO MORE QUESTIONS, BABY!" );
                    System.out.println();
                    System.out.println( "Think of something and I'll try to guess it!" );
                    System.out.println();
                    System.out.print( "Question 1) Does it stay inside or outside or both? " );
                    place = keyboard.next();
                    System.out.print( "Question 2) Is it a living thing? " );
                    status = keyboard.next();
                    if ( (place.equals("inside")) && (status.equals("yes")) )
                    {
                        thing = "house plant";
                    }
                    if ( (place.equals("inside")) && (status.equals("no")) )
                    {
                        thing = "shower curtain";
                    }
                    if ( (place.equals("outside")) && (status.equals("yes")) )
                    {
                        thing = "bison";
                    }
                    if ( (place.equals("outside")) && (status.equals("no")) )
                    {
                        thing = "billboard";
                    }
                    if ( (place.equals("both")) && (status.equals("yes")) )
                    {
                        thing = "dog";
                    }
                    if ( (place.equals("both")) && (status.equals("no")) )
                    {
                        thing = "cell phone";
                    }
                    System.out.println( "You are thinking of " + thing + "." );
                }
            }

                      
    

Picture of the output

Assignment 47