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
What does 4g consistâ of?
stellarik [79]
The answer is  (C) broadband cellular networks

Over the past decade, a majority of the mobile service providers have built 3G networks that use packet-switching technologies. Over time, 3G evolved into HSPDA which is five times faster than 3G. Predictably, 4G networks are now commonplace and are built from LTE and Mobile WiMAX.
5 0
4 years ago
major, large city newspaper endorsements often carry important weight, especially in down ballot races for local offices.
Lunna [17]

True- major, large city newspaper endorsements often carry important weight, especially in down ballot races for local offices.

<h3>What is endorsement?</h3>

Endorsements are a type of advertising that makes use of well-known figures or celebrities that enjoy a high level of public awareness, respect, and/or recognition. These persons serve as brand ambassadors by using their names or likenesses to advertise a good or service. An endorsement, in a broader sense, is an expression of agreement with or support for something or someone; the endorser may or may not get payment. A blank endorsement is one on which the endorser merely signs his name and the bearer is the recipient. Special Endorsement: This is where the endorser signs and specifies who will get the cash. Endorsement with Restrictions: This prevents further discussion.

To know more about endorsement visit:

brainly.com/question/29734234

#SPJ1

3 0
1 year ago
Web browser software requests web pages from the internet using which protocol?
Gekata [30.6K]
TCP/IP (Transmission Control Protocol / Internet Protocol)

This is a bad question. HTTP, HTTPS, FTP and with plugins hundreds of other protocols. If you want to mess with your teacher.
4 0
3 years ago
The screen that contains the Webpage you are viewing.
11Alexandr11 [23.1K]

Answer:

the content area is the screen that contains the webpage you are viewing

7 0
3 years ago
Kenny has gone to a rocky beach to take a photo of the sunset. He wants to level his shot perfectly. He is aware that his tripod
iragen [17]

Answer:

it would probably be on the right side

Explanation:

3 0
4 years ago
Read 2 more answers
Other questions:
  • Is there anyone willing to sign into my google classroom account and help with my work :( i had surgery on monday and have about
    14·2 answers
  • The use of an information system to support the sharing of content among networks of users related by common interests is termed
    10·1 answer
  • An automotive engine's camshaft rotates at
    8·2 answers
  • Write a single if-test using Boolean operators and relaional operators to determine if a double variable x is between zero (excl
    11·1 answer
  • Memory, as a general construct, is best defined as A) the ability to briefly retain information in the senses. B) the long-term
    12·2 answers
  • List of bad websites and why
    10·1 answer
  • Which of these expressions is used to check whether number is equal to value?
    15·2 answers
  • What is a good indicator that someone on social media is not who he or she claims to be?
    10·1 answer
  • Submitting Unit 11 Assignment – Step 1 Python CS Fundamentals<br> Need the code to this.
    8·1 answer
  • What are some industries of aerodynamics and hydrodynamics? explain each one in detail.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!