mercredi 13 juillet 2016

A Method that returns true if the Temperature objects represents a temp below freezing point (JAVA)

I'm trying to write a method named isLowerThanFreezing that returns true if the Temperature object represents a temperature below the freezing point for water (32.0 F, 0.0 C, or 273.15 K), and false otherwise. This method should include only one inequality (i.e, one comparison formed using <, <=, >, or >=), which can be accomplished by determining the value of the temperature in one of the three scales before performing the necessary comparison with the freezing point for that scale. I already have a method that does the necessary conversion but i'm not entirely sure how to structure the whole method in general

Any help is greatly appreciated!! Thanks

public boolean isLowerThanFreezing(double value, char scale) {
    if (Temperature <= (0.0) 'C') {
        convertTo();
        return true;
    } else {
        return false;
    }
}

convertTo is the method i have for the conversions

Aucun commentaire:

Enregistrer un commentaire