Short Java

profilePoohny Bear
Assignment2.java

import java.util.Scanner; class temp{ static void conversion(double temp,char scale) { if(scale!='c' && scale!='C' && scale!='f' && scale!='F') { System.out.println("Error! You've entered an invalid conversion type!"); } if (scale == 'F' || scale =='f') { System.out.println("The conversion of "+ temp +"°F "+ "to Celsius is: " + (5*(temp - 32)/9) + "°C"); } if (scale == 'C' || scale =='c') { System.out.println("The conversion of "+ temp +"°C "+ "to Fahrenheit is: " + (9*(temp)/5 + 32) + "°F"); } } } public class temptest { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Please enter the degree:"); double degree = scan.nextDouble(); System.out.println("Please enter F or C:"); char scale = scan.next().charAt(0); temp.conversion(degree,scale); } }