Assignemnt #50 and compareTo challenge
Code
/// Name: Kyle Ivy
/// Period: 5
/// Program Name: Compare
/// File Name: Compare.java
/// Date Finished: 12/2/2015
import java.util.Scanner;
public class Compare
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
System.out.print("Comparing \"dot\" with \"circle\" produces ");
System.out.println( "dot".compareTo("circle") );
System.out.print("Comparing \"root\" with \"branch\" produces ");
System.out.println( "root".compareTo("branch") );
System.out.print("Comparing \"apple\" with \"orange\" produces ");
System.out.println( "apple".compareTo("orange") );
System.out.print("Comparing \"rock\" with \"stone\" produces ");
System.out.println( "rock".compareTo("stone") );
System.out.print("Comparing \"puffy\" with \"flat\" produces ");
System.out.println( "puffy".compareTo("flat") );
System.out.print("Comparing \"black\" with \"black\" produces ");
System.out.println( "black".compareTo("black") );
System.out.print("Comparing \"solid\" with \"stripes\" produces ");
System.out.println( "solid".compareTo("stripes") );
System.out.print("Comparing \"grass\" with \"seeds\" produces ");
System.out.println( "grass".compareTo("seeds") );
System.out.print("Comparing \"bro\" with \"man\" produces ");
System.out.println( "bro".compareTo("man") );
System.out.print("Comparing \"me\" with \"allah\" produces ");
System.out.println( "me".compareTo("allah") );
System.out.print("Comparing \"squirrel\" with \"tiger\" produces ");
System.out.println( "tree".compareTo("tiger") );
System.out.print("Comparing \"nickle\" with \"penny\" produces ");
System.out.println( "nickle".compareTo("penny") );
}
}
prog50.PNG