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
Digital rights include the right to
faltersainse [42]
D. Speak your ideas with respect on the internet .
7 0
2 years ago
Computer World sells laptops separately from accessory products like docking stations, anti-virus software, and external hard dr
uysha [10]

Answer:

Optional product pricing

Explanation:

<em>Optional product pricing</em> occurs when a product is sold for a much lower price but complementary products or accessories are sold separately to generate profit.

A typical example is in the printer category, printer cartridges are sold separately from the printer when the one in the newly purchased printer runs out. The customer is forced to purchase new cartridges that the company benefits from as profits.

Optional product pricing is a strategy to provide less expensive technology while exploiting the frequent use of accessories to make a substantial profit.

6 0
3 years ago
What is the downside of wider channel bandwidth?
Lana71 [14]

Answer: Wider channel bandwidth has several downside or disadvantages to it. Some of these are as follow:

a) Higher channel bandwidth means lower will be the number of channels being utilized.

b) Wider bandwidth may lead to an increase in the speed but on the other hand, it'll lead to several interference problems.

6 0
3 years ago
Consider the following method: static void nPrint(String a, int n) { System.out.println(a.charAt(n)); } What potential error cou
Juliette [100K]
<span>Briefly explain why it is necessary to critique a scientific argument before it is accepted.
</span>
4 0
3 years ago
Choose the output result of the below code.
SIZIF [17.4K]

Answer:

B

Explanation:

When you initialize an instance of FunEvent(tags, year) and assign it to bc. The instance variables in this case are: self.tags = ["g", "ml"] and self.year = 2022. But then you alter tags, which will also change self.tags, since self.tags is a reference to the list you passed in as an argument. This is not the case when you do year=2023 because, first of all, integers are not mutable, and also because even if somehow integers were mutable, you're not changing the object in-place, you're simply changing the where the "variable" is pointing to. So for example if you did tags = ["g", "ml", "bc"] instead of tags.append("bc"), it would also not change the value of the instance variable "tags", because you wouldn't be changing the object in-place. So when you print(bc), the instance variables will be ["g", "ml", "bc"] and 2022. When you try to print an object, it call try to convert it into a string using the __str__  magic method. In this case it will return a string formatted as "Event(tags={self.tags}, year={self.year}) which will output "Event(tags=['g', 'ml', 'bc'], year=2022)" So the correct answer is B

4 0
2 years ago
Other questions:
  • Why is the answer A?
    6·1 answer
  • An embedded os must be developed specifically for use with embedded systems. true or false?
    6·1 answer
  • If str 1 and str2 are both Strings, which of the following expressions will correctly
    13·1 answer
  • What is the function of the command prompt?
    8·1 answer
  • A group of computers that are interconnected in order to share information or documents is called a _____.
    7·1 answer
  • Assume you are using the MINUS operator to combine the results from two tables with identical structure, CUSTOMER and CUSTOMER_2
    8·1 answer
  • This project involves writing a program that encodes and decodes messages. The program should prompt the user to select whether
    15·1 answer
  • NoSQL is a programming language used to create mobile apps.<br> a) True<br> b) False
    13·2 answers
  • What are the process of boots up a computer?​
    15·2 answers
  • Examples of application software​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!