Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java: Write a Java GUI application to do temperature conversions between Celcius, Fahranheit, and Kelvin. The GUI display should look something like the following:

In Java:

Write a Java GUI application to do temperature conversions between Celcius, Fahranheit, and Kelvin. The GUI display should look something like the following:image text in transcribed

Do not use any of the GUI editing capabilities of Eclipse for this assignment. Do all the GUI layout work, yourself.

The GUI and event handling setup should be done in the constructor of your GUI class or in private methods called from the constructor.

The display must have a label and JTextField where the user inputs a value which must appear in the upper part of the frame as shown above.

There should be a set of 3 radio buttons which indicate the input scale of the value to be converted. The 3 input scale buttons must be vertically aligned on the left side of the display as shown above.

There should be a set of 3 radio buttons which indicate the output scale to be converted to. The 3 output scale buttons must be vertically aligned and appear on the right side of the display as shown above.

Event handling must be setup so that selection of any input or output button causes an event which triggers the event handling code to determine which of 9 possible conversions is needed.

Event handling must also respond to the user hitting the enter key in the input textfield! For this event, the event handling code must also determine which conversion is needed based on which buttons are selected.

Display the conversion result in an output text field or in a JLabel which appears in the bottom part of the display as shown above. Output the degree symbol and output scale information as shown above. You can output a degree symbol by putting the character value 176 into a formatted string.

If a radio button is clicked when there is nothing in the input textfield, the event handler must display the string "No Input" in the output textfield.

Your program must accurately convert from Fahrenheit, Celcius, Kelvin to Fahrenheit, Celcius, Kelvin. Only the selected conversion is displayed in the output textfield.

You must create a separate class which does all the temperature conversion calculations. It should have 6 static methods, one for each possible conversion. Each of the 6 methods takes an input temperature and returns the appropriate converted temperature. This class could be used in any other application where temperature conversion is needed. You can find conversion formulas at the following website: http://en.wikipedia.org/wiki/Temperature_conversion

When the conversion selection changes due to clicking either an input or output scale button, the output area must change to show only the new result.

HINT: For radio button events, use the ItemListener interface and use the isSelected method on the radio buttons to find out which buttons are turned on!

The output must display 2 digits after the decimal point.

Make sure that you test all your conversion formulas

Also make sure that you add comments to your programs!

Input 100 Input Scale Output Scale Celcius ( ) Fahrenheit O Kelvin Celcius Fahrenheit O Kelvin Output 212.00 F

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

How will a change in income affect the location of the budget line?

Answered: 1 week ago

Question

Describe the five elements of the listening process.

Answered: 1 week ago