Back to project page android-appwidget-cirrus.
The source code is released under:
MIT License
If you think the Android project android-appwidget-cirrus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* Copyright 2014 Wayne D Grant (www.waynedgrant.com) Licensed under the MIT License */ //from w w w . j a v a 2 s.c o m package com.waynedgrant.cirrus.measures; import java.math.BigDecimal; import com.waynedgrant.cirrus.units.TemperatureUnit; public class Temperature { private BigDecimal celsius; private BigDecimal fahrenheit; public Temperature(BigDecimal celsius) { this.celsius = celsius; this.fahrenheit = (celsius.multiply(new BigDecimal("1.8"))).add(new BigDecimal("32")); } public BigDecimal getValue(TemperatureUnit unit) { BigDecimal value = null; switch (unit) { case CELSIUS: value = celsius; break; case FAHRENHEIT: value = fahrenheit; break; } return value; } }