Assignment #30

Code

    /// Name: Jonathan Stine
    /// Period: 5
    /// Program Name: Boolean2 
    /// File Name: Boolean2 .java
    /// Date Finished: 10/23/15
    
    import java.util.Scanner;
    
    public class Boolean2 
    {
        
        public static void main( String[] args ) 
        {
            
            Scanner keyboard = new Scanner(System.in);
            
            String word;
            boolean yep, nope;
            
            System.out.println( "Type the word \"weasel\", please." );
            word = keyboard.next();
            
            yep = "weasel".equals(word);
            /// this still works even though word and "weasel" are swapped.
            nope = ! word.equals("weasel");
            
            System.out.println( "You typed what was requested: " + yep );
            System.out.println( "You ignored polite instructions: " + nope );
            
        }
    }
    
 
    

Code Output