1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Annette [7]
3 years ago
5

Write a Temperature class that will hold a temperature in Fahrenheit, and will provide methods to get and display the temperatur

e in Fahrenheit, Celsius, and Kelvin. The Temperature class should have the following instance variable: ftemp – A double that holds a Fahrenheit temperature. The Temperature class should have the following methods: ReadInput – Uses a Scanner method to populate ftemp with double value. getFahrenheit – Returns the value of the ftemp field, as a Fahrenheit temperature. getCelsius – Returns the value of the ftemp field converted to Celsius. getKelvin – Returns the value of the ftemp field converted to Kelvin. DisplayOutput – The Fahrenheit temperature and the equivalent values in Celsius and Kelvin are gotten and displayed, one per line, and each along with an appropriate message.
Computers and Technology
1 answer:
natita [175]3 years ago
8 0

Answer:

See explaination

Explanation:

import java.util.Scanner;

public class TemperatureTest {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter Fahrenheit temperature: ");

double ftemp = sc.nextDouble();

Temperature temp = new Temperature(ftemp);

System.out.println("The temperature in Fahrenheit is " + temp.getFahrenheit());

System.out.println("The temperature in Celsius is " + temp.getCelsius());

System.out.println("The temperature in Kelvin is " + temp.getKelvin());

}

}

class Temperature {

double ftemp;

Temperature(double ftemp) {

this.ftemp = ftemp;

}

double getFahrenheit(){

return ftemp;

}

double getCelsius(){

return ((double)5/9*(ftemp-32));

}

double getKelvin(){

return (((double)5/9*(ftemp-32))+273);

}

}

Output:

$ java TemperatureTest

Enter Fahrenheit temperature: -40

The temperature in Fahrenheit is -40.0

The temperature in Celsius is -40.0

The temperature in Kelvin is 233.0

You might be interested in
Nam june paik’s ________ combines recognizable and distorted images made using a synthesizer to modulate video signals.
Alexeev081 [22]
The answer that fits the blank is GLOBAL GROOVE. Global Groove has been one of the most notable work in the history of video art because of the use of distorted images produced from a synthesizer and this modulated signals on the video. The Global Groove is a video from year 1973. 
6 0
3 years ago
what is the molarity of a solution prepared by dissolving 15.0g of sodium hydroxide in enough water to make a total of 225 ml of
Reptile [31]

Answer:

1.6666 g/mol = 1 \frac{2}{3} g/mol

Explanation:

Molar mass of NaOH= 23+16+1 =40g/mol

Mols in 15g = 15/40 mol

If this was dissolved in 225ml of water molarity of the solution is

\frac{15}{40} ÷ 225 x 1000 = 1.6666 g/mol = 1 \frac{2}{3} g/mol

5 0
3 years ago
The primary reason for the creation of the Federal Reserve System LOADING... ​was: A. to create a single central bank similar to
Gelneren [198K]

Answer: (C) to reduce or eliminate future bank panics.

Explanation:

The Federal Reserve System being the central reserve system in the US was created with the primary objective of reducing and eliminating bank panics in periods of recessions and depressions and other bank related matters.

3 0
3 years ago
For whover needed pont
podryga [215]

Answer:

Thank you have a nice day:)

8 0
3 years ago
Read 2 more answers
In a typical e-mail address, the "host" is user: which one of the following word processing features saves you the most time whe
gayaneshka [121]
Find-and-replace . hope this helps !
4 0
3 years ago
Other questions:
  • If one breakfast meal of banana lacatan, scrambled egg, plain rice, and hot milk contains 58 grams carbohydrate, 12 grams protei
    11·1 answer
  • How can volunteering yo help plan fundraiser for your team or club be a way to develop your strengths?
    13·1 answer
  • Não basta tornar-se móvel hoje em dia. Ao se organizar para a implantação de tecnologias no contexto da mobilidade, é preciso fi
    6·1 answer
  • If you used a peach as a model of an animal cell, what would the peach's skin represent? A.nucleus B.cell wall C.cytoplasm D.cel
    10·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    15·1 answer
  • What is the purpose of extent in lines in engineering drawing
    12·1 answer
  • A flower is an example of _______________? (Select the best answer.)
    13·2 answers
  • College entrance requirements are the expectations for admission.
    12·1 answer
  • Which three pieces of information should be included in an artist statement? Select all that apply.
    11·1 answer
  • What would the input, process, outcome and feedback be for a class assignment
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!