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]
4 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]4 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
allows Internet telephony service providers to deliver telephony services and unified communications applications offering voice
hram777 [196]

Answer:

VoIP

Explanation:

Voice over Internet Protocol. You can share videos, data, voice and other applications.

3 0
3 years ago
Write a program that uses two input statements to get two words as input. Then, print the words on one line separated by a space
Shkiper50 [21]

word1 = input("Enter a word: ")

word2 = input("Enter a word: ")

print(word1 + " " + word2)

I hope this helps!

6 0
3 years ago
Sometimes we write similar letters to different people. For example, you might write to your parents to tell them about your cla
OleMash [197]

?

?????????????????????

4 0
3 years ago
What are MS Word's default tabs?
pochemuha
File | Home | Insert | Design | Page Layout | References | Mailings | Review | View
3 0
4 years ago
Read 2 more answers
​When converting plain text to hexadecimal for use with ProDiscover, you need to place ____________ between each character's hex
mina [271]

Answer:

Null(00) is the correct answer to the following blank.

Explanation:

Because when we changing the plain text into the hexadecimal then, we have to place null(00) to use with pro-discover in the middle of each and every hexadecimal value. We use null(00) because the null value contains 0(zero) or having no value.

So, that's why the following answer i.e., null(00) is true.

3 0
4 years ago
Other questions:
  • Caroline has been asked to find a standard to guide her company’s choices in implementing information security management system
    13·1 answer
  • The _____ pseudo-class represents the exact instant in which a link is activated.​
    14·1 answer
  • Which do switches create?<br> Networks<br> Wireless access points<br> Routes<br> Collision domains
    12·1 answer
  • Consider the following two implementations of the same algorithm, each written in a different language.
    11·1 answer
  • Photography Help, Please!!
    9·2 answers
  • En su cuaderno o carpeta de trabajo realice la conversión del sistema de numeración binario a octal según este ejemplo de manera
    13·1 answer
  • When the city of chicago buys ipads™ for its restaurant inspectors to use during their visits, the purchase from apple would be
    13·1 answer
  • Create a list with 5 numbers and find the smallest and largest number in the list and also the sum and product of the numbers in
    9·1 answer
  • PLEASE HELP!!! WILLGIVE BRAINLIEST!!!
    11·2 answers
  • What is a trojan horse in computer science?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!