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
Suppose a reference variable of type Double called myDouble has already been declared. There is also a double variable x that ha
eimsori [14]

Answer:

Double newMyDouble = new Double(x);

myDouble = newMyDouble2;

Explanation:

Here the new object newMyDouble is firstly the initial value of said 'double x'. In the second line myDouble is the reassigned the the newMyDouble, which is in fact, the value of x. This exercise helps you understand the syntax of using reference variables in JAVA and their assignment along with reassignment.

5 0
3 years ago
Why is the Operating System the most important system software in a computer?
OleMash [197]

Answer:

(Hope this helps can I pls have brainlist (crown)☺️)

Explanation:

The most crucial programme that runs on a computer is the operating system. It controls the memory and operations of the computer, as well as all of its software and hardware. It also allows you to communicate with the computer even if you don't understand its language.

An operating system is a piece of software that manages files, manages memory, manages processes, handles input and output, and controls peripheral devices like disc drives and printers, among other things.

7 0
3 years ago
Physical security controls traditionally include obstacles, alarms, lights, guards, cameras, and responders that produce a(n) __
Lostsunrise [7]

Answer:

secure facility

Explanation:

7 0
3 years ago
Which of the following is typically an advantage of configuring your own hosting server over using an ISP or a cloud service pro
Inessa [10]

Answer:

D that's the answer it has to be

5 0
4 years ago
_______ testing is a customer test that involves placing the product within the firm to see how it performs in different applica
Maslowich

Answer: Alpha testing

Explanation:

Alpha testing is basically perform to identify the issues and bugs before release any product. This type of testing basically place the products within firm and performed different types of applications.

The alpha testing is usually perform before the release any software products. It is the combination of both white and black box testing. The main function of this testing is to simulate the users by carried out different tasks to perform.

The alpha testing is known as alpha because it is done at the end of the software development.  

7 0
4 years ago
Other questions:
  • Database designers typically do not add spaces in field names (LName), but can add details in the ________ field of the field pr
    12·1 answer
  • Stephen needs to insert a field into a building block that will contain variable data. Which keyboard shortcut can he use to tog
    6·1 answer
  • What are the benefits of using a multiview sketch to communicate a design?
    11·1 answer
  • In fixed-width files, each record is on a separate line and the fields are separated by a special character.
    7·1 answer
  • What do secondary sources rely on for their analysis of events?
    6·2 answers
  • To apply the StartSafe philosophy to preventing workplace violence, what are the three steps to follow? A. Plan for your job req
    12·2 answers
  • a flow chart is the _______ representation of the sequence of steps required of steps required to solve a particular problem​. I
    9·1 answer
  • 5. Played electronically by manipulating images on a television screen produced by a
    15·1 answer
  • what is the arrangement of various flash elements, such as the tools panel, control panel, property inspector and stage
    12·1 answer
  • Data is communicated through various input devices true or false​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!