forked from NoLongerNesquik/Java-Lab-003
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGettingHotInHere.java
More file actions
23 lines (20 loc) · 794 Bytes
/
Copy pathGettingHotInHere.java
File metadata and controls
23 lines (20 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.Scanner;
public class GettingHotInHere {
/**
* Teaching Mr. Roboto how to listen to us.
* @param args Command line arguments [The source file path, The target file path, ...]
**/
public static void main(String[] args) {
// The instantiation code for a Scanner instance.
Scanner scanner = new Scanner(System.in);
System.out.print("What is the temperature in °F: ");
int tempF = scanner.nextInt();
double tempC = (tempF - 32) * 5 / 9.0;
String output = """
Temperature: %d°F = %.2f°C
As an integer: %d°C
If it were 2°C warmer it would be %d°C
""";
System.out.printf(output, tempF, tempC, (int) tempC, 2 + (int) tempC);
}
}