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]
3 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]3 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
Is orange named after the fruit or of the color?
Alexeev081 [22]
I slick thinks it’s because of its color
4 0
3 years ago
Which of the following is not a method for opening Word software?
neonofarm [45]

Answer:

right clicking on the desktop and clicking "view"

8 0
2 years ago
Read 2 more answers
Which cell formatting is most likely to use $?
TiliK225 [7]
Currency is the correct answer
4 0
3 years ago
Read 2 more answers
The discipline of building hardware architectures, operating systems, and specialized algorithms for running a program on a clus
kondaur [170]

The discipline of building hardware architectures, operating systems, and specialized algorithms for running a program on a cluster of processors is known as <u>parallel computing.</u>

<u></u>

<h3>What is Parallel Computing?</h3>

Parallel computing refers to the process of breaking down larger problems into smaller, independent, often similar parts that can be executed simultaneously by multiple processors communicating via shared memory, the results of which are combined upon completion as part of an overall algorithm. The primary goal of parallel computing is to increase available computation power for faster application processing and problem solving.

<h3>Types of parallel computing</h3>

There are generally four types of parallel computing, available from both proprietary and open source parallel computing vendors:

  • Bit-level parallelism: increases processor word size, which reduces the quantity of instructions the processor must execute in order to perform an operation on variables greater than the length of the word.
  • Instruction-level parallelism: the hardware approach works upon dynamic parallelism, in which the processor decides at run-time which instructions to execute in parallel; the software approach works upon static parallelism, in which the compiler decides which instructions to execute in parallel.
  • Task parallelism: a form of parallelization of computer code across multiple processors that runs several different tasks at the same time on the same data.
  • Superword-level parallelism: a vectorization technique that can exploit parallelism of inline code.

Learn more about parallel computing

brainly.com/question/13266117

#SPJ4

5 0
2 years ago
What are the factors affecting the life of ballast? Explain.​
Nady [450]

Answer:

When it's too hot or too cold.

Explanation:

When a bulb of the wrong size or voltage is used in the fixture, the ballast often overheats, causing the light to shut off. The bulbs and the fixture must also match in frequency, or the ballast becomes overworked and overheated.

7 0
3 years ago
Other questions:
  • Demonstrate your grasp of the Unix file system by constructing a directory structure as follows: In your home ( ~ ) directory, c
    11·1 answer
  • Which type of password would be considered secure?
    15·1 answer
  • Write the definition of a method printAttitude, which has an int parameter and returns nothing. The method prints a message to s
    8·1 answer
  • Where would the information needed to start a computer be stored
    10·1 answer
  • What was one of the first inventions that made it possible to communicate almost instantly?
    11·1 answer
  • Which of the following correctly describes the function of an IP address
    13·1 answer
  • Which of the following could not be represented by columns in the SPSS data editor? a. Levels of between-group variables. b. Lev
    11·2 answers
  • (1 consider the following function definition: int func(int x, double y, char u, string name { //function body } which of the fo
    7·1 answer
  • How do you copy and paste a screenshot on an hd computer
    12·2 answers
  • Netflix shows to watch?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!