Guest User

Untitled

a guest
Mar 6th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. public void temperatureHandler() {
  2. if (cBox.getValue() == "Celsius (C)") {
  3. celsiusOutput.setText(Double.toString(dValue));
  4. fahrenheitOutput.setText(Double.toString((dValue * 1.8) + 32));
  5. kelvinOutput.setText(Double.toString(dValue + 273.15));
  6. }
  7. else if (cBox.getValue() == "Fahrenheit (F)") {
  8. celsiusOutput.setText(Double.toString((dValue - 32) / 1.8));
  9. fahrenheitOutput.setText(Double.toString(dValue));
  10. kelvinOutput.setText(Double.toString((dValue + 459.67) * 5/9));
  11. }
  12. else if (cBox.getValue() == "Kelvin (K)") {
  13. celsiusOutput.setText(Double.toString(dValue - 273.15));
  14. fahrenheitOutput.setText(Double.toString((dValue * 1.8) - 459.67));
  15. kelvinOutput.setText(Double.toString(dValue));
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment