ITEC 2610 Lecture 3: Celsius to Fahrenheit

10 views2 pages
Ambassador badge icon
22 Oct 2021
Course
Professor

Document Summary

Write a simple java application which will display a frame exactly like the temperature. Note that the text field and the label are centered. Users enter an integer value in the text field, and then press on one of the two buttons to get the conversion. The result should be displayed in the label below the buttons. Both the source and converted temperature are displayed as integers. Hints: the formula to compute fahrenheit from celsius is: f = (9/5)c + 32, the container reference is obtained with. Container c = this. getcontentpane(): integer. parseint(string) is a static method which converts a string into an int, you do not have to write the method main(), which is: public static void main(string[] args) { Tempconvframe appframe = new tempconvframe(); appframe. setdefaultcloseoperation(jframe. exit_on_close); appframe. setsize(250, 100); appframe. show(); Correct answer import java. awt. import java. awt. event. import javax. swing. public class tempconvframe extends jframe implements actionlistener { Jlabel l1; public tempconvframe() { super ("temperature converter ") ;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents