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
katrin [286]
3 years ago
8

Write a program that convert a temperature in Fahrenheit to the equivalent temperature in Celsius. The initial temperature in Fa

hrenheit is to be entered at the keyboard. Both temperatures should be output to the screen.

Computers and Technology
1 answer:
baherus [9]3 years ago
5 0

<u>Answer:</u>

//import the necessary class

import java.util.Scanner;

//Begin class definition

public class ConvertToCelsius{

   

       //Begin main method

    public static void main(String []args){

       //Create an object of the Scanner class

       Scanner input = new Scanner(System.in);

       

       //Display the aim of the program

       System.out.println("**Program to convert from Fahrenheit to Celsius**");

       

       //Prompt the user to enter the temperature in Fahrenheit

       System.out.println("Please enter temperature in Fahrenheit");

       

       //Receive the user's input

       //And store in the appropriate variable

       double tempF = input.nextDouble();

       

       //Convert the temperature to Celsius using

       //C = (9.0 / 5) * (F - 32)

       //C = temperature in Celsius, F = temperature in Fahrenheit

       double tempC = (9.0 / 5) * (tempF - 32);

       

       //Display the result

      System.out.println("The temperature in degree Celsius is: ");

       System.out.println(tempC);

       

       return;

       

    }    //End of main method

}    //End of class definition

<u>Sample Output</u>

**Program to convert from Fahrenheit to Celsius **

Please enter temperature in Fahrenheit

>> 32

The temperature in degree Celsius is:  

0.0

<u>Explanation</u>:

The above code has been written in Java and it contains comments explaining important lines of the code. Please go through the comment. Snapshots of the program and a sample output have been attached to this response.

You might be interested in
Which statement relating to a Works Cited page is NOT True?
oksano4ka [1.4K]
The incorrect answer is the second one: It is the first page in a research paper.
Works cited pages always come last.
7 0
4 years ago
Read 2 more answers
]
loris [4]
B. Which promotes a chemical reaction
5 0
3 years ago
Discuss how a lack of infrastructure in poor communities could contribute to ill-health such as the Unrest looting.​
shutvik [7]

Answer:No service from hospital for injured people

Explanation:

Yes of course

4 0
3 years ago
Its an HTML5 anyone kwons
Aleksandr [31]

Answer:

1 will be stored in result

Explanation:

Given

The lines of code

Required

Determine the value stored in result

The value stored in result is determine by the condition (x<3 && y ==6)

In the first line, the value of x is 2 and the value of y is 6

So: x<3 is true because x = 2 and 2 is less than 3

y == 6 is also true because y = 6 and 6 is equal to 6

So, the condition (x<3 && y ==6) is true and true will be saved in variable result

Because result is a Boolean variable which can only take true or false value

1 represents true

0 represents false

<em>So, 1 will be stored in result</em>

7 0
3 years ago
What is the output of the code corresponding to the following pseudocode? (In the answer options, new lines are separated by com
Viefleur [7K]

Answer:

Following are the output of the given question

3 4 6 8

Explanation:

In the following code, firstly, we have declare two integer data type "X" and "Y".

  • Then, set two for loop in which first one is outer loop and the second one is the inner loop, inner loop starts from 1 and end at 2 and outer loop starts from 3 and end at 4.
  • Then, when the variable X=1 then the condition of the outer loop become true and the check the condition of the inner loop, when Y=3, than the multiplication of X and Y occur and output should be 1*3=3.
  • Then, the value of the X will remain same at time when the value of Y become false. Thrn, second time X=1 and Y=4 and output should be 4.
  • Then, X=2 because Y turns 5 so the inner loop will terminate and than outer loop will execute. Then again Y=3 but X=2 and output should be 6.
  • Then, the value of the X will remain same at time when the value of Y become false. Thrn, second time X=2 and Y=4 and output should be 8.

Finally, all the conditions of the loop become false and the program will terminate.

3 0
4 years ago
Other questions:
  • _ includes websites that encourage interaction and connection among people, businesses, and organizations. A. News sites B. Sear
    5·2 answers
  • A common use-case for dictionaries is to store word counts. Let's modify our program below to store the count for each unique wo
    9·1 answer
  • A newly installed server communicates properly with its SCSI drives for six hours before requiring a reboot to continue communic
    11·1 answer
  • What is the term for a media piece that is ineligible for protection by copyright laws,
    15·1 answer
  • What do u mean by software​
    7·1 answer
  • Plz help
    8·1 answer
  • System.out.print();
    10·1 answer
  • Which of the following is an example of effective nonverbal communication?
    8·1 answer
  • Cidr simplifies how routers and other network devices need to think about the parts of an ip address, but it also allows for mor
    13·1 answer
  • Write a recursive decent algorithm for a java while statement, a Javas if statement , an logical/mathematical expression based o
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!