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
Danny is editing the text content of a single page on a website he created a year ago. What part of the tag would he have to upd
Verdich [7]
<h2>"<lastmod>" is the right choice for the given scenario</h2>

Explanation:

<update> This tag does not belong to <URL> tag of the site map. Hence this option goes invalid.

<lastmod> This gives details of the date and time when the website content was changed. It will be in "W3C Date time format". This may omit time at times. This is the write answer.

<loc> This contains the URL of the web page.

<changefreq>: How frequently the "web page is likely to get modified". The  values which it accepts are: "monthly, always , daily , weekly ,hourly, yearly , never"

5 0
3 years ago
Huan wants to enter the science fair at his school. He has a list of ideas for his project. Which questions could be answered th
never [62]

<u>Answer:</u>

<em>Science fair always has experiments which prove science concepts.</em> Students will bring apparatus or an lab items and show experiments as a magic. There are only certain things which a Science can prove and show to other.

<em>From the given question, the following can be proved: </em>

  • <em>Does pressure have an effect on the volume of a gas? </em>
  • <em>Which brand of soap is the best for cleaning grease off dishes? </em>
  • <em>Which laboratory experiment is the most fun to perform?</em>

<em> The below cannot be proved but can be explained </em>

  • <em>Is the information on the periodic table difficult to understand? </em>
  • <em>Which physicist was the smartest?</em>
4 0
3 years ago
Define undo and redo​
Varvara68 [4.7K]

The undo function is used to reverse a mistake, such as deleting the wrong word in a sentence. The redo function restores any actions that were previously undone using an undo. ... For example, if you typed a word, and then deleted it using an undo, the redo function would restore the word you delete

What do you mean by redo?

: to do (something) again especially in order to do it better. : to change (something, such as a room or part of a room) so that it looks new or different. See the full definition for redo in the English Language Learners Dictionary.

<em>What is Undo ?</em>

<em>What is Undo ?Undo is an interaction technique which is implemented in many computer programs. It erases the last change done to the document, reverting it to an older state. In some more advanced programs, such as graphic processing, undo will negate the last command done to the file being edited.</em>

8 0
3 years ago
To add slides to a presentation, _____.
Effectus [21]
<span>select the New Slide option from the Insert menu</span>
7 0
3 years ago
What is the most complex part of a PC?
rjkz [21]

Answer:

From a hardware standpoint, the CPU is most likely the main component. From a software standpoint, macOS and Windows are complex software systems.

Explanation:

6 0
2 years ago
Other questions:
  • It's time for you to schedule a dental checkup. The responsible thing to do is to ___
    11·1 answer
  • As yall know its spoopy season. This means spoopy music! I am having a live stream on the Spoon app under the username teendrago
    11·1 answer
  • If you find yourself boxed in by a vehicle on your left or right _____________
    14·2 answers
  • What makes smartphones so fragile?
    7·1 answer
  • A signal has a spectrum from 0 to 145 Hz, as shown below. It is sampled at a rate of 295 Hz. Find the region of the baseband spe
    5·2 answers
  • William found out that someone used his report on american culture without his permission. what is william a victim of?
    11·1 answer
  • 1.Terry turned on his computer one day to find that all of the storage on his computer was filled up. Furthermore, there were ma
    6·1 answer
  • How do you get a crown on this website<br> look under your points on the right side of your picture
    15·2 answers
  • This is the term for the manual process of editing strips of the film before digital editing was created. The term is still used
    9·1 answer
  • What type of an attack is being executed if an attacker substituted an invalid mac address for the network gateway so no users c
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!