From 647f2f4d3b7fc759af647e058d058cd3743e74af Mon Sep 17 00:00:00 2001 From: ishwar Date: Fri, 15 Dec 2023 22:57:15 -0800 Subject: [PATCH] lab 3 --- .idea/misc.xml | 1 - src/GettingHotInHere.java | 13 +++++++++++++ src/MrRoboto.java | 2 ++ 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..853a8ef 100644 --- a/src/GettingHotInHere.java +++ b/src/GettingHotInHere.java @@ -10,5 +10,18 @@ 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(); + double temp = (number - 32) * ( 5.0 / 9.0); + //print the temp user put in as a string + System.out.println(number + "°F"); + //print the converted temp + System.out.println(temp); + //print the converted as a int + //String temp2 = String.format("%.0f",temp); + + System.out.printf("%.6f°C%n",temp); + //print the converted If it were 2°C warmer + double warmer = temp + 2.0; + System.out.println("If it were 2°C warmer it would be: " + warmer + "°C"); + } } diff --git a/src/MrRoboto.java b/src/MrRoboto.java index c576091..c2ae1c6 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 + //scanned the users input ending at the enter key + String text = scanner.nextLine(); } }