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
The 8086 was divided into two main parts. The _____ was the "brain" of the processor, and had the ALU, general-purpose register,
jonny [76]

Answer:

1.Execution Unit.  2.Bus interface unit

Explanation:

3 0
3 years ago
I need help with Python. The first image is the code and the 2nd is the output.
Gekata [30.6K]
The issue arises because the string you are trying to print is not a string, rather a float value. Item1, item2 and item3 are strong values (if you type some alphabets in it and not just numbers), but itemonecost, itemtwocost, and itemthreecost are explicitly type casted to float. In line 22, 23, and 24 you’re trying to print a float, by adding it with the string. One cannot add numbers to string. Rather you can type cast the itemcost to string while printing.

Add str(itemonecost) instead of itemonecost in print statement. Do this for other float variables too.

However do note that there are multiple ways to correct this issue, and I’ve just pointed one out.
4 0
3 years ago
____________improves the understandability of a website, by maintaining similar design elements throughout.
lora16 [44]

Simple and easy user interface design can help the users understand what they can do on the website, without confusion when they are loading on the website.

Best practice on the users experiences can help the users to visit the website easily and get what they want as fast as possible. It is the way to improve a website understandability.

4 0
3 years ago
Which site had a major influence on the social gaming site Friendster?
Oduvanchick [21]
The answer is, "Ryze".
4 0
3 years ago
Read 2 more answers
What best describes the difference between plagiarism and fair use
Colt1911 [192]
The answer is ..........
 
<span>Fair use </span>

The doctrine of fair use allows the limited use of copyrighted material for certain educational, scholarly and research purposes without the permission of the copyright owner. It applies to any copyrighted material regardless of source, including the Internet. If you photocopy a page from one of your textbooks or print a page from a copyrighted Internet site for certain educational, scholarly or research purposes, your actions may fall under the doctrine of fair use. The copyright laws give you permission to copy the work<span> (with certain limitations), even though the owner of the copyright did not.


V.S

</span>Plagiarism

Plagiarism is "the representation of another's work or ideas as one's own; it includes the unacknowledged word-for-word use and/or paraphrasing of another<span> person's work, and/or the inappropriate unacknowledged use of another person's </span><span>ideas" (The Ohio State University Code of Student Conduct). This means that if </span><span>you use another person's work when completing any academic assignment,</span><span> </span><span>regardless </span>

5 0
3 years ago
Read 2 more answers
Other questions:
  • If reading or writing a cache line of size 64 bytes to Flash requires 2.56 μJ and DRAM requires 0.5 nJ, and if idle power consum
    9·1 answer
  • A directional antenna issues wireless signals along a(n) ____ direction.
    9·1 answer
  • (50 points) Write a program arrays1.cthat checks if two integer arrays are different by one and only one elementwhen compared el
    5·1 answer
  • The systems development life cycle (SDLC) is the overall process of developing, implementing, and retiring information systems t
    9·1 answer
  • Write a method called swapPairs that switches the order of values in an ArrayList of strings in a pairwise fashion. Your method
    9·1 answer
  • Suppose that outfile is an ofstream variable and output is to be stored in the file outputData.out. Which of the following state
    15·1 answer
  • Flash drives, CDs, external disks are all examples of storage (memory) devices.'True or false?
    9·1 answer
  • Which technique is best suited to create technical drawings?
    10·1 answer
  • What are the local, state, and national opportunities that may be available to those who participate in CTSOs?
    9·1 answer
  • A large retail company hires several new joiners and would like to incorporate Virtual Reality (VR) into their onboarding proces
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!