From 362a49f05ecbfdd9ef316ad875e0f3a1b84b896f Mon Sep 17 00:00:00 2001 From: agarcia923 Date: Tue, 26 Sep 2023 12:18:20 -0700 Subject: [PATCH] Completed Lab 003 --- .idea/misc.xml | 1 - src/GettingHotInHere.java | 12 ++++++++++++ src/MrRoboto.java | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) 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..f0fd57a 100644 --- a/src/GettingHotInHere.java +++ b/src/GettingHotInHere.java @@ -10,5 +10,17 @@ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("What is the temperature in °F: "); int number = scanner.nextInt(); + + System.out.print("Enter temperature in °F: "); + double fahrenheit = scanner.nextDouble(); + double celsius = (fahrenheit - 32) * 5 / 9; + int celsiusInt = (int) celsius; // Convert to integer + double warmerCelsius = celsius + 2; + + System.out.println(fahrenheit + "°F"); + System.out.printf("%.6f°C\n", celsius); // Print as a floating point number with 6 decimal places + System.out.println(celsiusInt + "°C"); + System.out.println("If it were 2°C warmer it would be: " + warmerCelsius + "°C"); + } } diff --git a/src/MrRoboto.java b/src/MrRoboto.java index c576091..aa80ccc 100644 --- a/src/MrRoboto.java +++ b/src/MrRoboto.java @@ -15,5 +15,8 @@ public static void main(String[] args) { System.out.print("My name is Mr. Roboto, are you Kilroy? "); // Write your program here + System.out.print("Enter a line of text: "); + domo = scanner.nextLine(); // Use the scanner instance to read a line of text + System.out.println("Domo arigato " + domo); //Print the user's } }