Question: Complete the program below so that it prompts the user for a temperature value, followed by a character that represents the type of temperature: .

 Complete the program below so that it prompts the user for

Complete the program below so that it prompts the user for a temperature value, followed by a character that represents the type of temperature: . Cfor Celeius .F for Farhenhei fthe character represents Fahrenheit temperature convert the temperature vahe to the equi a ent value in Celsne using the where C represents the Celsius temperature value, and F represents the Farhenheit temperature value. Ifthe character represents Ceaus temperature ), convert the temperature value to the equivalent vane n Farbenher us ng the low ng Omn a C = (59)(F-32.0) ollowme om a F-95)C+32.0 with F and C defined the same as above Print the converted value. Complete the following file Temperatures.java 1 import java.util.Scanner A program that reads in a temperature in degrees that may be Fahenheit or may be Celsius. The second input value is the string "F" for Fahrenheit or "C" for Celsius. If the string is an "F", the temperature read was Farhenheit, which needs to be converted to Celsius If the string is an "C, the temperature read was Celsius, which needs to be converted to Fahrenheit The converted temperature is then printed 18 12 13 public class Temperatures 15 public static void main (String] args) 16 17 18 19 // Define constants /I Your work here // Display prompt for temperature in degrees Farhenheit or Celsius System.out.print("Please enter the temperature in degrees: "): // Read temperature Scanner in = new Scanner(System.in); double temp in.nextDouble); 26 27 // Display prompt for character that denotes type of temperature System.out.print("Enter F for Farhenheit or C for Celsius:" 38 // Read character denoting type of temperature string type in.next); 32 // Compute and print Celsius or Farhenheit equivalent 35 36 37 38 // Your work here System.out.println(convertedTemp); 41

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!