From 53310a7c2e2e74ccc4a08bce040d2ea4ef4e9a34 Mon Sep 17 00:00:00 2001 From: Skyler Date: Wed, 27 Sep 2023 14:37:37 -0700 Subject: [PATCH] assignment completed --- .idea/misc.xml | 1 - src/GettingHotInHere.java | 11 ++++++++++- src/MrRoboto.java | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index cf9abe6..b95853c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/src/GettingHotInHere.java b/src/GettingHotInHere.java index 7a5b209..7fbcb22 100644 --- a/src/GettingHotInHere.java +++ b/src/GettingHotInHere.java @@ -8,7 +8,16 @@ public class GettingHotInHere { 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 number = scanner.nextInt(); + int fahr = scanner.nextInt(); // Read input Fahrenheit + double cent = (fahr - 32) * (5.0/9.0); // Calculate centigrade + int centint = (int) cent + 100; // Int casted centigrade with arbitrary value + + // Formatted and appended outputs + System.out.printf("The current temperature in Fahrenheit is %d degrees, which is %.2f degrees Celcius. " + + "Were it 100 degrees hotter, it would be %d degrees Celcius, and you would be dead.\n", fahr, cent, centint); + + System.out.printf("\nFahrenheit int: " + fahr + "\nCentigrade double: " + cent + "\nCentigrade int: " + (int) cent + "\n"); // Required type outputs for assignment } } diff --git a/src/MrRoboto.java b/src/MrRoboto.java index c576091..8ab0036 100644 --- a/src/MrRoboto.java +++ b/src/MrRoboto.java @@ -15,5 +15,7 @@ public static void main(String[] args) { System.out.print("My name is Mr. Roboto, are you Kilroy? "); // Write your program here + String name = scanner.nextLine(); // Get user input for name + System.out.println(domo + name); // Print concatenated strings } }