Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

319/2017 Temperature Conversion This program will input a temperature and the Te

ID: 3864362 • Letter: 3

Question

319/2017 Temperature Conversion This program will input a temperature and the Temperature system and convert the temperature to other system. Input: Temperature, Temperature System (Fahrenheit or Celsius) Output: Converted temperature Declare variable: temperature, system, counter Prompt user for temperature Get temperature Prompt user for system Get system c. celsius 32) 5.1. IF system is c' or (F- (9.015. e) method to convert Celsius to Fahrenheit 5.1.2. Display results in method 5.2. ELSE IF system is 'F' or 'f' celcius (c-(s.e19) (Fahrenheit 5.2.1 Call method to convert Fahrenheit to 5.2.2. Display results in method 5.3. ELSE 5.3.1. Display error message to user Exit program write a Jana Prosram M

Explanation / Answer

code.java


package javaapplication1;

import java.util.Scanner;

public class code {

public static void degree_to_f( float temp)
{
System.out.println(temp + " degree = " + ((9.0/5.0)*temp + 32.0) + " ferade");
}
public static void f_to_degree(float temp)
{
System.out.println(temp + " ferade = " + (5.0/9.0*(temp - 32)) + " degree");
}
public static void main(String[] args)
{
float temp;
String system;
Scanner scanner = new Scanner(System.in);
System.out.println("Enter temperature: ");
temp = scanner.nextFloat();
System.out.println("Enter System: ");
system = scanner.next();
if("c".equals(system) | "C".equals(system) )
{
degree_to_f(temp);   
}
else if("F".equals(system) | "f".equals(system))
{
f_to_degree(temp);
}
else
{
System.out.println("Invalid Input ");
}

}
  
}

Sample Output:

Enter temperature:
38
Enter System:
c
38.0 degree = 100.4 ferade

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote