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
allochka39001 [22]
4 years ago
13

Write a program that allows the user to convert a temperature given in degrees from either Celsius to Fahrenheit or Fahrenheit t

o Celsius. Use the following formulas: Degrees_C = 5(Degrees_F− 32)/9 and Degrees_F = (9(Degrees_C)/5) + 32) Prompt the user to enter a temperature and either a C or c for Celsius or an F or f for Fahrenheit. Convert the temperature to Fahrenheit if Celsius is entered, or to Celsius if Fahrenheit is entered. Display the result in a readable format. If anything other than C, c, F, or f is entered, print an error message and stop.
Computers and Technology
1 answer:
lutik1710 [3]4 years ago
7 0

Answer:

import java.util.Scanner;

public class num6 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter the temperature");

       double temp = in.nextDouble();

       System.out.println("Enter C to convert to celsius or F for fahrenheit");

       String con = in.next();

       if (con.equalsIgnoreCase("C")) {

           double Degrees_C = 5 * (temp - 32) / 9;

           System.out.println("The temperature of " + temp + "F in Celcius is" +

                   " " + Degrees_C);

       } else if (con.equalsIgnoreCase("F")) {

           //Degrees_F = (9(Degrees_C)/5) + 32)

           double Degrees_F = (9 * (temp) / 5) + 32;

           System.out.println("The temperature of " + temp + " celcius in Farenheit is" +

                   " " + Degrees_F);

       } else {

           System.out.println("Invalid value for conversion");

       }

   }

}

Explanation:

Use Scanner Class to prompt and receive user input

Use string method equalsIgnoreCase in an if statement to test the conversion to degrees celcius or farenheit

evaluate and output the values based on the equation given in the question

You might be interested in
Explain step-by-step how to rename a document (without opening it) that is filed in the My Computer/My Documents folder.
Lina20 [59]
You go on folder and double click on the title in your folder hope this is helpful :)
8 0
4 years ago
Compute the approximate acceleration of gravity for an object above the earth's surface, assigning accel_gravity with the result
san4es73 [151]

Answer:

G = 6.673e-11

M = 5.98e24

accel_gravity = 0.0

dist_center = float(input())

accel_gravity = (G * M) / (dist_center * dist_center)

print('Acceleration of gravity: {: .2f}'.format(accel_gravity))

Explanation:

The G, M, and accel_gravity are already initialized

The user is asked to enter the dist_center which is the only missing thing in the formula

In order to calculate the accel_gravity, you just need to put the variables in the formula (Note that the formula is (G*M)/(d^2), not d)

Then, the calculated value of accel_gravity is printed

4 0
3 years ago
Which of the following is not a primary environment in Autodesk Inventor? A. Parts B. Assemblies C. Animations D. Presentations
UNO [17]

I want to say it's C. Animations.

I hope this helps!

7 0
3 years ago
What time is spellrd the same forwards and backwards​
Juliette [100K]
12:21 is the correct answer
6 0
3 years ago
Andy uses a dial-up modem to connect to the Internet. He usually browses news sites, but he notices that online video takes a lo
Korvikt [17]
The answer is C. The modem does not contain enough bandwidth to handle modern video streaming.
4 0
4 years ago
Read 2 more answers
Other questions:
  • A technician is troubleshooting a PC with multiple volumes. To verify which are active and assigned drive letters, the technicia
    9·1 answer
  • Brock wants to use several images on his hiking blog. However, the images are making his pages load very slowly. Explain to Broc
    6·1 answer
  • How can volunteering to help plan a fundraiser for your team or club be a way to develop your strengths?
    10·2 answers
  • Which item is essential to know before sketching a navigation menu flowchart? template specifics, such as horizontal or vertical
    12·1 answer
  • Plzzzzz help right answer gets Brainly
    10·1 answer
  • Your task is to improve a multi-threaded program that frequently writes small entries to a shared file by introducing a layer th
    7·1 answer
  • An image can be copied from the Internet or another location and pasted into Paint.
    13·1 answer
  • This is my new horrible subject lol
    13·1 answer
  • A large lens can be very heavy and can only be supported at the_______.
    13·1 answer
  • What accesses organizational databases that track similar issues or questions and automatically generate the details to the repr
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!