Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TestTemp
- {
- public static void main(String[] args)
- {
- // testing constructors and set methods
- Temperature temp1 = new Temperature(0.0, 'C');
- Temperature temp2 = new Temperature(32.0, 'F');
- Temperature temp3 = new Temperature(-40.0);
- temp3.setScale('C');
- Temperature temp4 = new Temperature('F');
- temp4.setDegrees(-40.0);
- Temperature temp5 = new Temperature();
- temp5.setInfo(100.0, 'C');
- Temperature temp6 = new Temperature(212.0, 'F');
- // testing fahrenheit/celsius conversion
- System.out.println(temp1.returnFahrenheit()); //32
- System.out.println(temp2.returnCelsius()); //0
- // testing get methods
- System.out.println(temp1.getTemperature()); //0
- System.out.println(temp1.getScale()); //C
- temp5.equalize(temp6);
- temp5.writeOutput(); // should return 100.0, C
- temp5.writeOutput(); // should return 212.0, F
- // testing comparison methods
- temp6.setInfo(212.0, 'F');
- System.out.println(temp1.equals(temp2)); //should return T : error when equalize not working
- System.out.println(temp3.equals(temp4)); //should return T
- System.out.println(temp5.equals(temp5)); //should return T
- System.out.println(temp1.equals(temp6)); //should return F
- System.out.println(temp2.equals(temp4)); //should return F
- System.out.println(temp1.isGreaterThan(temp6)); //should return F
- System.out.println(temp2.isGreaterThan(temp4)); //should return T
- System.out.println(temp1.isLessThan(temp6)); //should return T : error when equalize not working
- System.out.println(temp2.isLessThan(temp4)); //should return F
- }
- }
Add Comment
Please, Sign In to add comment