Package edu.ucsd.cs110w.temperature

Examples of edu.ucsd.cs110w.temperature.Celsius


public class CelsiusTests extends TestCase {
  private float delta = 0.001f;
  public void testCelsius() {
    float value = 12.34f;
    Celsius temp = new Celsius(value);
    assertEquals(value, temp.getValue(), delta);
  }
View Full Code Here


    Celsius temp = new Celsius(value);
    assertEquals(value, temp.getValue(), delta);
  }
  public void testCelsiusToString(){
    float value = 12.34f;
    Celsius temp = new Celsius(value);
    String string = temp.toString();
    String beginning = "" + value;
    String ending = " C";
    //Verify the suffix of the formatted string
    assertTrue(string.startsWith(beginning));
    //Verify the prefix of the formatted string
View Full Code Here

    // (Hint: what is the length of the middle of the string?)
    assertTrue(string.substring(0, endIndex).equals(beginning));
  }
  public void testCelsiusToCelsius()
  {
    Celsius temp = new Celsius(0);
    Temperature convert = temp.toCelsius();
    assertEquals(0, convert.getValue(), delta);
  }
View Full Code Here

    Celsius temp = new Celsius(0);
    Temperature convert = temp.toCelsius();
    assertEquals(0, convert.getValue(), delta);
  }
  public void testCelsiusToFahrenheit(){
    Celsius temp = new Celsius(0);
    Temperature convert = temp.toFahrenheit();
    assertEquals(32, convert.getValue(), delta);
    temp = new Celsius(100);
    convert = temp.toFahrenheit();
   
    assertEquals(212, convert.getValue(), delta);
  }
View Full Code Here

   
    assertEquals(212, convert.getValue(), delta);
  }
 
  public void testCelsiusToKelvin() {
    Celsius temp = new Celsius(0);
    Temperature convert = temp.toKelvin();
    assertEquals(273, convert.getValue(), delta);
    temp = new Celsius(100);
    convert = temp.toKelvin();
   
    assertEquals(373, convert.getValue(), delta);
  }
View Full Code Here

TOP

Related Classes of edu.ucsd.cs110w.temperature.Celsius

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.