Explore BrainMass
Share

Programing in Java: Fahrenheit to Celsius

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

I have to write a Java program that converts fahrenheit to celsius.

The formula is: celsius = (5 / 9) * (fahrenheit - 32)

The program read a Fahrenheit degree in double from the input dialog box then converts it to Celsius and displays the result in a message dialog box.

In Java, 5 / 9 is 0, so I need to write 5.0 / 9 to obtain the correct result.

The program should also convert feet into meters. The program prompts the user to enter a number in feet, converts it to meters, and displays the result. One foot is 0.305 meters.

© BrainMass Inc. brainmass.com October 16, 2018, 9:18 pm ad1c9bdddf
https://brainmass.com/computer-science/java/programing-java-fahrenheit-celsius-179597

Solution Summary

This solution provides guidelines on writing a java program that will convert fahrenheit to celsius, and feet into meters.

$2.19
Similar Posting

JAVA Program: Celsius to Fahrenheit Conversion

1. Temperature Conversion
Modify the temperature conversion program so that it converts Celsius to Fahrenheit. Use the formula: fahr = celsius*9/5+32

2. Two-Way Conversion
Add two buttons to the temperature conversion program. Clicking one button converts Fahrenheit to Celsius, clicking the other converts Celsius to Fahrenheit. It would help the user to have a "clear" button that clears the text in both text fields.

View Full Posting Details