Write a temperature class

Assignment Help JAVA Programming
Reference no: EM131282125

Write a Temperature class that will hold a temperature in Fahrenheit and provide methods to get the temperature in Fahrenheit, Celsius, and Kelvin.

The class should have the following field: . ftemp: a double that holds a Fahrenheit temperature.

The class should have the following methods : 

Constructor : The constructor accepts a Fahrenheit temperature (as a double ) and stores it in the ftemp field. . setFahrenheit: The set Fahrenheit method accepts a Fahrenheit temperature (as a double ) and stores it in the ftemp field. . getFahrenheit: Returns the value of the ftemp field as a Fahrenheit temperature (no conversion required) . getCelsius: Returns the value of the ftemp field converted to Celsius.

Use the following formula to convert to Celsius: Celsius = (5/9) * (Fahrenheit - 32) . getKelvin: Returns the value of the ftemp field converted to Kelvin.

Use the following formula to convert to Kelvin: Kelvin = ((5/9) * (Fahrenheit - 32)) + 273

Demonstrate the Temperature class by writing a separate program that asks the user for a Fahrenheit temperature.

The program should create an instance of the Temperature class, with the value entered by the user passed to the constructor.

The program should then call the object 's methods to display the temperature in the following format

for example, if the temperature in Fahrenheit was -40):

The temperature in Fahrenheit is -40.0

The temperature in Celsius is -40.0

The temperature in Kelvin is 233.0

Reference no: EM131282125

Questions Cloud

Determine best way to estimate cost of a gallon of gasoline : Determine the best way to estimate the value of time. Determine the best way to estimate the cost of a gallon of gasoline. Justify your position.
Identify the line codes that have minimum average energy : Identify the line codes that have minimum average energy and those that do not. Compare your answers with the observations made on these line codes.
Depending on the person : The answer to this question will vary depending on the person and his or her values and background. Some students are more focused on day-to-day personal needs and others on broader societal or global concerns.
Which of two constellations has minimum average energy : The two signal constellations shown in Figure exhibit the same average probability of symbol error. Justify the validity of this statement. -  Which of these two constellations has minimum average energy?
Write a temperature class : Write a Temperature class that will hold a temperature in Fahrenheit and provide methods to get the temperature in Fahrenheit, Celsius, and Kelvin.
Examine this case study in terms how conflict can arise : Examine this case study in terms how conflict can arise and escalate. The discussion will probably require that you fully investigate the Thai-Cambodian case.
What is the author of the story trying to teach his audience : What literary and dramatic devices, such as plot, character, theme, setting, and symbols, are used in the story to convey messages? Explain how they are used. What might have happened if the Prince had sacrificed his life for the Little Mermaid?
Expand its current emergency plan : Assume that your selected agency received funding to expand its current emergency plan, which involves the Department of Corrections and Department of Juvenile Justice.
Estimate the total rate of heat loss from the above-ground : The insulation maintains the outer surface of the steel sheathing at approximately 10°C. If the ambient temperature averages 0°C and prevailing winds are 2 m/s from the northeast, estimate the total rate of heat loss from the above-ground portion ..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd