Write a program that creates a Celsius Converter Application.The application should accept temperature in Celsius and display temperature in Farenheit
[Conversion Formula: FarenHeitTemp = CelsiusTemp * 1.8 + 32].
[Conversion Formula: FarenHeitTemp = CelsiusTemp * 1.8 + 32].
SOLUTION:
import javax.swing.JOptionPane; public class TemperatureConversion { public static void main(String [] args){ //Reading Celsius temperature String cel = JOptionPane.showInputDialog("Enter Temperature in celcius"); //Calculating Fahrenheit temperature float far=0; float celsius=Float.parseFloat(cel); far = celsius*1.8f + 32; //Showing output JOptionPane.showMessageDialog(null, "Farenhiet Temperature = "+far); } }
No comments:
Post a Comment