Temperature Convertor is a simple temperature converter from Celsius to Fahrenheit and Kelvin.
Temperature Convertor is a simple project representing the Fahrenheit and Kelvin equivalent temperatures for the given Celsius temperature.
Follow the below steps to build the project:
=> Create a new Project in Eclipse IDE.
=> Insert the UI components into the layout.
=> Perform the operations using buttons in the UI.
Create a new Project in Eclipse IDE :
Open Eclipse IDE and create a new Java project with an application Window.
Insert the UI components into the layout :
The next step is to add the Layout/frame. That is, add a text field for reading input, a button for performing Celsius to Fahrenheit operation, and a button for performing Celsius to Kelvin. And show the result in a dialogue box using the JOptionpane component.
The below picture shows the layout of the temperature converter:
Perform the operations using buttons in the UI :
The final step is to add action listeners to those buttons that are in the frame. That is, add an action listener for the button "Show in Fahrenheit" and "Show in Celsius".
Use the following formula for converting Celsius to Fahrenheit :
Temperature in Fahrenheit = ((temperature in celsius)*(9/5)) +32
Use the following formula for converting Celsius to Kelvin :
Temperature in Kelvin = temperature in Celsius + 273.15
The result by clicking Fahrenheit is shown below:
The result by clicking Kelvin is shown below:
Also if we provided an invalid input, then it will show as "Please enter a valid input" as shown below :
Hence, this is a simple and easy project for those who is beginning their career in java developer. Hope this finds useful to you.
Thank You.
Submitted by P. Veera Sai Rakesh (SaiRakesh31)
Download packets of source code on Coders Packet
Comments