Assignment #50 COmpareTo Challenge
Code
/// Name: DeeJay Cerezo
/// Period: 7
/// Program Name:compareToChallenge
/// File Name: Compare.java
/// Date Finished: 12/1/2015
class Compare
{
public static void main(String[] args)
{
//Above zero
System.out.println("Numbers above zero:");
System.out.print("Comparing \"Shinobu\" with \"Oshino\" produces ");
int a = "Shinobu".compareTo("Oshino");
System.out.println(a);
System.out.print("Comparing \"applebee's\" with \"apple\" produces ");
int d = "applebee's".compareTo("apple");
System.out.println(d);
System.out.print("Comparing \"nana\" with \"hachi\" produces ");
int e = "nana".compareTo("hachi");
System.out.println(e);
System.out.print("Comparing \"yandere\" with \"kuudere\" produces ");
int j = "yandere".compareTo("kuudere");
System.out.println(j);
System.out.print("Comparing \"yes\" with \"no\" produces ");
int h = "yes".compareTo("no");
System.out.println(h);
//Below zero
System.out.println("Numbers below zero:");
System.out.print("Comparing \"Lanku\" with \"Sakura\" produces ");
int f = "Lanku".compareTo("Sakura");
System.out.println(f);
System.out.print("Comparing \"Blue\" with \"Red\" produces ");
int g = "Blue".compareTo("Red");
System.out.println(g);
System.out.print("Comparing \"nande\" with \"naze\" produces ");
int i = "nande".compareTo("naze");
System.out.println(i);
System.out.print("Comparing \"ichi\" with \"ni\" produces ");
int b = "ichi".compareTo("ni");
System.out.println(b);
System.out.print("Comparing \"san\" with \"yon\" produces ");
int c = "san".compareTo("yon");
System.out.println(c);
//Equal Zero//
System.out.println("Numbers Equal to Zero:");
System.out.print("Comparing \"hai\" with \"hai\" produces ");
int k = "hai".compareTo("hai");
System.out.println(k);
System.out.print("Comparing \"keki\" with \"keki\" produces ");
int l = "keki".compareTo("keki");
System.out.println(l);
}
}
Picture of the output