Assignemnt #50 and Comparing
Code
///Name: Ben Borglin
///Period: 6
///Program Name: Comparing
///File Name: Comparing.java
///Date Finished: 10/6/15
import java.util.Scanner;
public class Comparing
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int apple, shirts, dress, dog, davis, katz, banana, mark, sirdan, purple, green, yellow, blue, black, fat, phat, skinny, cardio, fit, age, name, date;
System.out.print("Comparing \"apple\" with \"shirts\" produces ");
int a = "apple".compareTo("shirts");
System.out.println(a);
System.out.print("Comparing \"banana\" with \"dog\" produces ");
int b = "banana".compareTo("dog");
System.out.println(b);
System.out.print("Comparing \"dress\" with \"dress\" produces ");
int c = "dress".compareTo("dress");
System.out.println(c);
System.out.print("Comparing \"abc\" with \"abc\" produces ");
int d = "abc".compareTo("abc");
System.out.println(d);
System.out.print("Comparing \"davis\" with \"katz\" produces ");
int e = "davis".compareTo("katz");
System.out.println(e);
System.out.print("Comparing \"sirdan\" with \"purple\" produces ");
int f = "sirdan".compareTo("purple");
System.out.println(f);
System.out.print("Comparing \"green\" with \"yellow\" produces ");
int g = "green".compareTo("yellow");
System.out.println(g);
System.out.print("Comparing \"blue\" with \"black\" produces ");
int h = "blue".compareTo("black");
System.out.println(h);
System.out.print("Comparing \"fat\" with \"phat\" produces ");
int i = "fat".compareTo("phat");
System.out.println(i);
System.out.print("Comparing \"skinny\" with \"cardio\" produces ");
int j = "skinny".compareTo("cardio");
System.out.println(j);
System.out.print("Comparing \"fit\" with \"age\" produces ");
int k = "fit".compareTo("age");
System.out.println(k);
System.out.print("Comparing \"name\" with \"date\" produces ");
int l = "name".compareTo("date");
System.out.println(l);
}
}
Picture of the output