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
vivado [14]
3 years ago
8

Make a program that (i) asks the user for a temperature in Fahrenheit degrees and reads the number; (ii) computes the correspond

ing temperature in Celsius degrees; and (iii) prints out the temperature in the Celsius scale.
Computers and Technology
1 answer:
Lerok [7]3 years ago
5 0
<h2>Answer:</h2><h2></h2>

//import the Scanner class to allow for user's input

import java.util.Scanner;

//Create a class declaration with appropriate name

public class FahrenheitToCelsius {

   //Begin the main method where execution starts from

   public static void main(String[] args) {

       //Create an object of the Scanner class to allow reading from standard

       // input

       Scanner input = new Scanner(System.in);

       

       //Prompt the user to enter the temperature

       System.out.println("Enter a temperature in Fahrenheit degrees");

       

       //Read the number and store in a variable of type double

       double fahrenheit = input.nextDouble();

       

       

       //Convert the temperature to Celsius

       double celsius  = (fahrenheit - 32) * (5 / 9.0);

       

       //Print out the result

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

       

   } //End of main method

   

}   //End of class declaration

==============================================================

<h2>Sample Output 1:</h2><h2 />

>> Enter a temperature in Fahrenheit degrees

32

>> The temperature in Celsius is 0.0

==============================================================

<h2>Sample Output 2:</h2><h2 />

>> Enter a temperature in Fahrenheit degrees

78

>> The temperature in Celsius is 25.555555555555557

===============================================================

<h2>Explanation:</h2>

The code has been written in Java and it contains comments explaining every segment of the code. Please go through the comments.

The actual lines of code are written in bold face to separate them from the comments.

Sample outputs have also been given to show how the result of the program looks like.

You might be interested in
What would be the output of the following program?
Natalka [10]

Answer:

Output: 2004 2008 2058  

Explanation:

In the first printf command it will print the address of the variables num, msg1, msg2. And in the second printf command it will print the values of the variables num, msg1, msg2. As the address of the structure is 2004 And the size of the integer is 4 byte so size will increase with 4 bytes and the size of character is 1 byte so it will increase by 1*50= 50 bytes.

Hence, the output is 2004 2008 2058  

8 0
3 years ago
Which concept allows the computer to repeat a group of steps in an
allochka39001 [22]

Answer:

A

Explanation:

I was gonna say 'loop' from my computing days. but it is now called iteration

7 0
2 years ago
The autocorrect feature can automatically capitalize the first letter in the names of days. true false
Westkost [7]
The answer is that it is true
3 0
3 years ago
Devices used for viewing images from one computer to another over the internet
garri49 [273]
Its a monitor otherwise the screen on a computer
3 0
3 years ago
Who is the Queen of rap?
mote1985 [20]

Answer:

A. Nicki Minaj

only valid answer but every1 else is good too!

5 0
3 years ago
Other questions:
  • . the web is based on the ________ protocol
    6·1 answer
  • a. Show the output of the following program: 1: public class Test { 2: public static void main ( String [] args ) { 3: A a = new
    14·1 answer
  • Which computer network component allows data transfers from one computer to another through a telephone line?
    11·2 answers
  • Sam wants to move across the text and his documents to add data at predefined stops. Which key will Hughes to navigate through t
    6·1 answer
  • What will be the output after the following code is executed? def pass_it(x, y): z = y**x return(z) num1 = 3 num2 = 4 answer = p
    7·1 answer
  • What is presentation
    15·2 answers
  • WILL GIVE BRAINLIEST!!!!!!!
    14·1 answer
  • How can I convert a string to a int? in Java
    13·1 answer
  • 15. Question
    12·1 answer
  • The ____ line for any e-mail messages you write should clearly state the intention of the e-mail..
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!