Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a 3 part problem for my computer science class that I am completely lost on. This is the first part: Write a Temperature

I have a 3 part problem for my computer science class that I am completely lost on.

This is the first part:

  • Write a Temperature class that has two instance variables: a temperature value (a floating-point number) and a character for the scale, either C for Celsius or F for Fahrenheit. The class should have four constructor methods: one for each instance variable (assume zero degrees if no value is specified and Celsius if no scale is specified), one with two parameters for the two instance variables, and a no-argument constructor (set to zero degrees Celsius).

    Include the following: (1) two accessor methods to return the temperature-one to return the degrees Celsius, the other to return the degrees Fahrenheit-use the following formulas to write the two methods, and round to the nearest tenth of a degree:

    DegreesC = 5(degreesF - 32)/9 DegreesF = (9(degreesC)/5) + 32; 
    (2) three mutator methods: one to set the value, one to set the scale (F or C), and one to set both; and (4) a suitable toString method. Then write a driver program (or programs) that tests all the methods. Be sure to use each of the constructors, and to test at least the following temperature equalities: 0.0 degrees C = 32.0 degrees F, -40.0 degrees C = -40.0 degrees F, and 100.0 degrees C = 212.0 degrees F.

This is the second part of the question:

  • In that Temperature assignment, you have implemented two formulas to convert between Celsius and Fahrenheit. Now, you will implement your solution in Java Swing.
  • You are free to design any meaning GUI interface.
  • You have to use JTextField as input and it only received valid double as input -- provide very simple Exception Handling. You are free to design what to do with invalid input.

This is the third part to the question

  • Reorganize
    1. Temperature conversion in /model folder
    2. UI in /view folder
    3. Driver.java to start the program
  • Additionally
    1. Temperature conversion as static method
    2. Use only inner classes for JButton Actions (no more ActionListener)
    3. Use metal look and feel

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

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

Distinguish between poor and good positive and neutral messages.

Answered: 1 week ago

Question

Describe the four specific guidelines for using the direct plan.

Answered: 1 week ago