Assignment #50

Code

    ///Name: Cody Swain
    ///Period: 6
    ///Project Name: Prog613
    ///File Name: Prog613.java
    ///Date: 10/16/15
    
    import java.util.Scanner;

    public class compareTo
    {
        public static void main( String[] args )
        {
        
        Scanner keyboard = new Scanner(System.in);
        
        System.out.print("Comparing \"cat\" with \"dog\" produces ");
        System.out.println( "cat".compareTo("dog") ); 
        
        System.out.print("Comparing \"tree\" with \"rock\" produces ");
        System.out.println( "tree".compareTo("rock") ); 
        
        System.out.print("Comparing \"lemon\" with \"apple\" produces ");
        System.out.println( "lemon".compareTo("apple") ); 
            
        System.out.print("Comparing \"peach\" with \"watermelon\" produces ");
        System.out.println( "tree".compareTo("rock") ); 
        
        System.out.print("Comparing \"school\" with \"church\" produces ");
        System.out.println( "school".compareTo("church") ); 
            
        System.out.print("Comparing \"computer\" with \"computer\" produces ");
        System.out.println( "computer".compareTo("computer") ); 
            
        System.out.print("Comparing \"peach\" with \"peach\" produces ");
        System.out.println( "peach".compareTo("peach") ); 
            
        System.out.print("Comparing \"zebra\" with \"dirt\" produces ");
        System.out.println( "zebra".compareTo("dirt") ); 
            
        System.out.print("Comparing \"dude\" with \"man\" produces ");
        System.out.println( "dude".compareTo("man") ); 
            
        System.out.print("Comparing \"jesus\" with \"monkey\" produces ");
        System.out.println( "jesus".compareTo("monkey") ); 
            
        System.out.print("Comparing \"elephant\" with \"rhinoceros\" produces ");
        System.out.println( "elephant".compareTo("rhinocerous") ); 
            
        System.out.print("Comparing \"war\" with \"fist\" produces ");
        System.out.println( "fist".compareTo("thistle") ); 
            
            
        }
    }

        
    

Picture of the output

Assignment 50