From 3bba7c0cd08ab80f1df915edce4071fa2ae34911 Mon Sep 17 00:00:00 2001 From: dyoungxboxpro Date: Wed, 27 Sep 2023 14:20:18 -0700 Subject: [PATCH] completed Lab 3 --- .idea/misc.xml | 2 +- src/GettingHotInHere.java | 22 +++++++++++++++++++++- src/MrRoboto.java | 6 +++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index cf9abe6..501ce09 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/GettingHotInHere.java b/src/GettingHotInHere.java index 7a5b209..e90a0fb 100644 --- a/src/GettingHotInHere.java +++ b/src/GettingHotInHere.java @@ -8,7 +8,27 @@ 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: "); + System.out.print("What is the temperature in °F: "); int number = scanner.nextInt(); + System.out.println(number + "°F" ); + + double celsius = (number - 32) * (5.0/9); + System.out.printf("%.3f°C\n", celsius ); + int ci = (int) celsius; + System.out.println(ci + "°C"); + double celsius2 = celsius + 2; + String A = "If it were 2°C warmer it would be"; + System.out.printf("%s %.3f°C\n", A, celsius2); + + + + + + + + + + + } } diff --git a/src/MrRoboto.java b/src/MrRoboto.java index c576091..614f812 100644 --- a/src/MrRoboto.java +++ b/src/MrRoboto.java @@ -11,9 +11,13 @@ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); // Concatenate the user response to this String. - String domo = "Domo arigato "; + String domo = " Domo arigato "; System.out.print("My name is Mr. Roboto, are you Kilroy? "); // Write your program here + String line1 = scanner.nextLine(); + System.out.println(domo+line1); + + } }