Question: Define a class named Temperature that maintains the temperature in Fahrenheit. Declare and define the following data members and methods for this class: Define a

Define a class named Temperature that maintains the temperature in Fahrenheit. Declare and define the following data members and methods for this class: Define a data member tempDegrees of type double to hold the temperature value. Define a default constructor for this class. Define a method set Temperature that sets the value of tempDegrees. Define a method getFahrenheit () that returns the temperature in Fahrenheit. Define a method getCelsius () that returns the temperature in Celsius. The methoduses the formula tempC =(tempDegrees-32.0)*5.0/9.0 to convert the temperature toCelsius.2. Using this class, write a driver class (program) such as testTemperature that reads the value of the temperature in Fahrenheit and, using the methods of the class, prints the value in Celsius.Note: First, define the class Temperature and store it in a file named Temperature java Then, write the driver program and save it in another file, testTemperature.java. Run the program, making sure that both files are part of the same project (in the same directory).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!