Placeholder

COMP 274 Week 4 Lab Java Program to Convert Temperature

$15.00

Description

Write a Java GUI application to do temperature conversions between Celcius, Fahranheit, and Kelvin. The GUI display should look something like the following:
Your program must meet the following requirements:
Do not use any of the GUI editing capabilities of Eclipse for this assignment. Do all the GUI layout work based on what you have learned in class in the last 2 weeks.
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 and the error case handling.
Also make sure that you add comments to your program.
Take screen shots of the program doing 2 different conversions and handling one of the error cases.
Paste the screen shots and the source code for your program into a Word document.
SCREENSHOTS
SOLUTION
PAYMENT
ENTIRE COURSE
The solution includes a zip file.
Attachments [Move over files to preview content of those files]
COMP274_Lab_4.zip (165.97 KB)
COMP274_LAB4_Document.docx
COMP274_Lab4_Temperature_Converter_Screenshot.png
java source code
TemperatureGUI.java
TemperatureUtils.java
Netbeans project
COMP274Lab4
build
classes
.netbeans_automatic_build
.netbeans_update_resources
TemperatureGUI.class
TemperatureUtils.class
week4
build.xml
manifest.mf
nbproject
build-impl.xml
genfiles.properties
private
private.properties
project.properties
project.xml
src
TemperatureGUI.java
TemperatureUtils.java
test
Preview TemperatureGUI.java
xxxxxxx xxxxxxxxxx xxxxxxx = xxx xxxxxxxxxx(7);
xxxxxxx xxxxxxxxxx xxxxxxxx = xxx xxxxxxxxxx(7);
xxxxxxx xxxxxx xxxxxxx = xxx xxxxxx(“xxxxx”);
xxxxxxx xxxxxx xxxxxxxx = xxx xxxxxx(“xxxxxx”);
xxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx;
private JRadioButton inputFahrenheit; private JRadioButton inputKelvin; private JRadioButton outputKelvin; private JRadioButton outputCelsius; private JRadioButton outputFahrenheit; private JLabel inputLabel; private JLabel outputLabel;
public TemperatureGUI(String title) { super(title); setSize(400, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
xxxxxxxxxx(xxxx);
// xxxxxx xxxxx xxxxx
xxxxxx xxxxxxxxxx = xxx xxxxxx();
xxxxxxxx = xxx xxxxxxxxxxxxxx();
xxxxxxx.xxxxxxx(“1”);
Preview TemperatureUtils.java
xxxxxx xxxxx xxxxxxxxxxxxxxxx {
xxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxx(xxxxxx x) {
xxxxxx x – 273;
}
public static double fahrenheitToCelsius(double t) { return ((5.0 / 9.0) * (t – 32)); }
public static double kelvinToFahrenheit(double t) {
xxxxxx (((x – 273) * (1.8)) + 32);
}
xxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxx(xxxxxx x) {
xxxxxx x + 273;
}
Preview TemperatureGUI.java
xxxxxxx xxxxxxxxxx xxxxxxx = xxx xxxxxxxxxx(7);
xxxxxxx xxxxxxxxxx xxxxxxxx = xxx xxxxxxxxxx(7);
xxxxxxx xxxxxx xxxxxxx = xxx xxxxxx(“xxxxx”);
xxxxxxx xxxxxx xxxxxxxx = xxx xxxxxx(“xxxxxx”);
xxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx;
private JRadioButton inputFahrenheit; private JRadioButton inputKelvin; private JRadioButton outputKelvin; private JRadioButton outputCelsius; private JRadioButton outputFahrenheit; private JLabel inputLabel; private JLabel outputLabel;
public TemperatureGUI(String title) { super(title); setSize(400, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
xxxxxxxxxx(xxxx);
// xxxxxx xxxxx xxxxx
xxxxxx xxxxxxxxxx = xxx xxxxxx();
xxxxxxxx = xxx xxxxxxxxxxxxxx();
xxxxxxx.xxxxxxx(“1”);
Preview TemperatureUtils.java
xxxxxx xxxxx xxxxxxxxxxxxxxxx {
xxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxx(xxxxxx x) {
xxxxxx x – 273;
}
public static double fahrenheitToCelsius(double t) { return ((5.0 / 9.0) * (t – 32)); }
public static double kelvinToFahrenheit(double t) {
xxxxxx (((x – 273) * (1.8)) + 32);
}
xxxxxx xxxxxx xxxxxx xxxxxxxxxxxxxxx(xxxxxx x) {
xxxxxx x + 273;
}
Price: $15
Buy Now
Checkout
Added to cart
Buy More Save More
Buy at least TWO items & save up to 30% OFF your ENTIRE order!
Rack up instant rebates in your shopping cart. Simply add items to your cart, and see the savings add up.
Discounts will automatically be applied on eligible orders.
COMP 274 Week 4 Lab Java Program to Convert Temperature – $15.00
COMP 274 Week 5 Lab Timer and Mouse Events and Java Graphics – $19.00
COMP 274 Week 6 Lab Calendar Program – $19.00
COMP 274 Week 7 Lab Java Doc – $19.00
Add to Cart
Checkout
Added to cart
FLASH SALE
$75
$108
Save $30
COMP274 Entire Course
Get Entire Course
You May Also Like:
COMP 274 Entire Course
COMP 274 Week 1 Lab
COMP 274 Week 2 Lab Inheritance and Polymorphism
COMP 274 Week 3 Lab Java Application GUI
COMP 274 Week 5 Lab Timer and Mouse Events and Java Graphics
COMP 274 Week 6 Lab Calendar Program
COMP 274 Week 7 Lab Java Doc

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.