Question

Question: Fahrenheit To Celsius Temperature Converter GUI Assignment Write A GUI To... java Fahrenholt to Celsius Temperature
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

CODE: Java Programming Language

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class TempConvertor {
   JFrame f;
   TempConvertor()   {
       f=new JFrame("Fahrenheit to Celcius Temprature Convertor");
       JLabel GUI=new JLabel("Fahrenheit to Celcius Temprature Convertor",SwingConstants.CENTER);
       GUI.setForeground(Color.red);
       JLabel lbl= new JLabel("Fahrenheit Temprature ");
       JTextField textTemprature=new JTextField();
       JLabel ansLbl= new JLabel("Celcius Temprature ");
       JButton btnCalculate=new JButton("Convert");;
       btnCalculate.addActionListener(new ActionListener(){
           public void actionPerformed(ActionEvent e){
               double tempFah,tempCel;
               tempFah=Double.parseDouble(textTemprature.getText());
               tempCel=(5.0/9.0)*(tempFah-32);
               ansLbl.setText((String.format("%.1f %s",tempCel,"degree Celcius.")));
           }
       });
       f.add(GUI,BorderLayout.NORTH);
       f.add(lbl,BorderLayout.WEST);
       f.add(textTemprature,BorderLayout.CENTER);
       f.add(ansLbl,BorderLayout.EAST);
       f.add(btnCalculate,BorderLayout.SOUTH);
       f.setSize(350,110);
       f.setVisible(true);
   }
   public static void main(String[] args) {
       new TempConvertor();
   }
}

==========================================================================

SCREENSHOT OF THE CODE:

10 import java.awt.*; 2 import java.awt.event. ActionEvent; 3 import java.awt.event. ActionListener; 4 import javax.swing.*;

==========================================================================

OUTPUT:

х Fahrenheit to Celcius Temprature Con... Fahrenheit to Celcius Temprature Convertor Fahrenheit Temprature Celcius Temprature

Fahrenheit to Celcius Temprature Con... х Fahrenheit to Celcius Temprature Convertor Fahrenheit Temprature 157.0 69.4 degree

Thank you

Add a comment
Know the answer?
Add Answer to:
Question: Fahrenheit To Celsius Temperature Converter GUI Assignment Write A GUI To... java Fahrenholt to Celsius...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have...

    C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have 2 Labels (each one of them assigned only to Celsius and Fahrenheit), 2 TextBoxes (each one of them assigned only to Celsius and Fahrenheit), only 1 Convert Button, 1 Clear Button, and 1 Exit Button. Also, 1 Error message label which will display the error messages. The application should only allow the user to enter the desired temperature just in one of the TextBoxes...

  • Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin...

    Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin Newton Your program should take a character which represents the temperature to convert from and a value to be converted to using the following specification: C - Celsius K - Kelvin N - Newton In addition your program should take in the following character to exit the program: X - eXit the program The numeric input for your program should be of type double....

  • Java program Write a Temperature class that represents temperatures in degrees in both Celsius and Fahrenheit....

    Java program Write a Temperature class that represents temperatures in degrees in both Celsius and Fahrenheit. Use a floating- point number for the temperature and a character for the scale, eitherでfor Celsius or 'F' for fahrenheit. The class should have Four constructors: one for the number of degrees, one for the scale, one for both the degrees and scale, and a default constructor. For each of these constructors, assume zero degrees if no value is specified and celsius if no...

  • Programming Exercise 8.3 | Instructions Write a GUI-based program that allows the user to convert temperature...

    Programming Exercise 8.3 | Instructions Write a GUI-based program that allows the user to convert temperature values between degrees Fahrenheit and degrees Celsius. The interface should have labeled entry fields for these two values. breezypythongui.py temperatureconvert... + 1 2 File: temperatureconverter.py 3 Project 8.3 4 Temperature conversion between Fahrenheit and Celsius. 5 Illustrates the use of numeric data fields. 6 • These components should be arranged in a grid where the labels occupy the first row and the corresponding fields...

  • Use Kilometer Converter application code to write Temperature Converter application to convert degrees Fahrenheit into degrees...

    Use Kilometer Converter application code to write Temperature Converter application to convert degrees Fahrenheit into degrees Celsius ((F - 32)*5/9). It needs to be JavaFX 1 import javafx.application. Application; 2 import javafx.stage. Stage; 3 import javafx.scene. Scene; 4 import javafx.scene.layout.HBox; 5 import javafx.scene.layout. VBox; 6 import javafx.geometry.Pos; 7 import javafx.geometry.Insets; 8 import javafx.scene.control.Label; 9 import javafx.scene.control. TextField; 10 import javafx.scene.control.Button; 11 import javafx.event. EventHandler; 12 import javafx.event. ActionEvent; 13 14 ** 15 * Kilometer Converter application 16 17 18 public...

  • In java Se8 i am trying to write a program convert temperature between celsius, fahrenheit and...

    In java Se8 i am trying to write a program convert temperature between celsius, fahrenheit and kelvin, but i am stuck at how to return the proper result without chage the frame, and I cnould not figure out how to use those three settemp method. import java. uti1. Arrays public class Temperature different scale names/ public static Stringll scales -Celsius", "Fahrenheit", "Kelvin private double temperature private char scale; public Temperature (double temp temp 273. 15; this. scale-C if (temp <-273....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT