/** * Write a description of class Test here. * * @author (your name) * @version (a version number or a date) */ public class Test extends junit.framework.TestCase { public void testDouble() { double x = 0.999999999; double y = 1.0; assertEquals(x, y, 0.0001); } public void testString() { String dept1 = "CS"; String dept2 = "cs".toUpperCase(); System.out.println("dept1 = " + dept1); System.out.println("dept2 = " + dept2); if(dept1 == "CS") System.out.println(dept1 + " (dept1) is CS"); else System.out.println(dept1 + " (dept1) is not CS"); if(dept2 == "CS") System.out.println(dept2 + " (dept2) is CS"); else System.out.println(dept2 + " (dept2) is not CS"); } public void testString2() { String dept1 = "CS"; String dept2 = "cs".toUpperCase(); System.out.println("dept1 = " + dept1); System.out.println("dept2 = " + dept2); if(dept1.equals("CS")) System.out.println(dept1 + " (dept1) is CS"); else System.out.println(dept1 + " (dept1) is not CS"); if("CS".equals(dept2)) System.out.println(dept2 + " (dept2) is CS"); else System.out.println(dept2 + " (dept2) is not CS"); } public void testString3() { //if("Devin" > "Gray") int compareVal = "Devin".compareTo("Gray"); System.out.println("compareVal = " + compareVal); if(compareVal > 0) System.out.println("Devin is greater than Gray"); else System.out.println("Devin is not greater than Gray"); } public void testString4() { String a = "Devin"; String b = "Gray"; System.out.println("a = " + a.length() + ", b =" + b.length()); } public void testConstant() { double epsilon = 1.0e-9; //change value epsilon = 5.0; final double epsilon2 = 1.0e-9; //try to change value //epsilon2 = 6.0; } public void testBoolean() { int score = 55; if (score >= 50) if (score < 60) System.out.println("You almost passed"); if (score >= 50 && score < 60) System.out.println("You almost passed"); //if(50 <= score < 60) // System.out.println("You almost passed"); } }