October 2017
Beginner
318 pages
7h 26m
English
Our goal is to create a temperature conversion program, and I've set up the input portion of this program for us already:
public class TemperatureConverter {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
char inputType;
char outputType;
float inputValue;
float returnValue;
System.out.print("Input type (F/C/K): ");
inputType = reader.next().charAt(0);
System.out.print("Output type (F/C/K): ");
outputType = reader.next().charAt(0);
System.out.print("Temperature: ");
inputValue = reader.nextFloat();
}
}
So far, this program takes three pieces of information from the user. The first is the temperature type: F for Fahrenheit, C for Celsius, and K for Kelvin. Then it takes another ...
Read now
Unlock full access