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]
2 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]2 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
in your own ideas what are the disadvantages of participating in a videoconference write your answer inside the circle​
ipn [44]
Some disadvantages of taking part in a video-conference are:

1) Lack of communication from social cues (social cues are what we use to see if someone is in a good or bad mood)

2) There is a high chance of unstable network connection.

3) Technical and personal issues because not everyone is comfortable speaking on a video-conference platform.

4) It causes more stress due to the lack of organization when preparing meetings (because it’s so easy to just get on a device without preparing anything beforehand).

Hope this helped!
5 0
2 years ago
Microsoft word's spelling checker will offer suggestions on misspelled words.<br> True)<br> False)
Rasek [7]
This is true. I hope I was helpful!
7 0
3 years ago
Read 2 more answers
Write down the appropriate technical term of following statements.​
MrRa [10]

Answer:

it is not seeing full. please give full

8 0
2 years ago
A call to a value-returning function with an empty formal parameter list has the form ________ .
gizmo_the_mogwai [7]
The correct answer is D
4 0
3 years ago
Greedy Algorithm Design
Alik [6]

Answer:

The algorithm is as follows:

1. Start

2. Get the number of items (n)

3. Get the current price of the n items (a1, a2..... an)

4. Get the possible hiked price of the n items (b1, b2..... bn)

5. Calculate the difference between the current and hiked prices for each item i.e. d_i = b_i - a_i

6. Sort the differences in descending order (i.e. from the greatest to the least)

7. Buy items in this order of difference

8. Stop

Explanation:

The algorithm is self-explanatory; however, what it does is that:

It takes a list of the current price of items (say list a)

E.g: a = [100, 150, 160]

Then take a list of the hiked price of the items (say list b)

E.g: b = [110, 180, 165]

Next, it calculates the difference (d) between corresponding prices d_i = b_i - a_i

d = [(110 - 100),(180-150),(165-160)]

d = [10,30,5]

Sort the difference from greatest to lowest (as the difference is sorted, lists a and b are also sorted)

d = [30,10,5]

a = [150, 100, 160]

b = [180, 110, 165]

If there is no hike up to item k, the couple would have saved (i = 1 to d[k-1])

Assume k = 3

The couple would have saved for 2 item

Savings = d[1] + d[2]

Savings = 30 +10

Savings = 40

The saved amount will then be added to the kth item in list a i.e. a[k](in this case k = 3) in order to buy b[k]

Using the assumed value of k

a[k] = a[3]

a[3] = 160

b[3] = 165

Add the saved amount (40) to a[3]

New\ Amount = 40 + 160

New\ Amount = 200

This new amount can then be used to buy b[3] i.e. 165, then they save the change for subsequent items

8 0
3 years ago
Other questions:
  • For each of these statements find a domain for which the statement is true and a domain for which the statement is false. a) Eve
    13·1 answer
  • What is the name of the most expensive car and how much is it and what are its features
    15·1 answer
  • In cell I8, enter a nested logical function to display Need to Remodel if the apartment is unoccupied (No) AND was last remodele
    9·1 answer
  • Identify the correct sequence of steps to change the font from Verdana to Arial.
    10·1 answer
  • As technology advances, does technology become more of less complex?
    14·1 answer
  • Which one way in which using infrared in game console controllers could affect the experience of a person playing the game?
    8·1 answer
  • I only put one answer and didn’t specify what it answered
    14·2 answers
  • Write a program that uses the Purchase class in 5.13. Set the prices to the following: Oranges: 10 for $2.99 Eggs: 12 for $1.69
    11·1 answer
  • The most important preinstalled software is the ______ software that allows you to use the computer the first time you turn it o
    7·1 answer
  • The percentage of typical calls that would reach a respondent eligible to participate in a project is called the
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!