fixed the calculateTemperature method