diff --git a/.idea/misc.xml b/.idea/misc.xml index 639900d..6f29fee 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Error001.png b/Error001.png new file mode 100644 index 0000000..4eeb938 Binary files /dev/null and b/Error001.png differ diff --git a/Error002.png b/Error002.png new file mode 100644 index 0000000..8684e78 Binary files /dev/null and b/Error002.png differ diff --git a/Error003.png b/Error003.png new file mode 100644 index 0000000..2ae3110 Binary files /dev/null and b/Error003.png differ diff --git a/Java-Lab-003.iml b/Java-Lab-003.iml index b46c0dd..e1006ff 100644 --- a/Java-Lab-003.iml +++ b/Java-Lab-003.iml @@ -5,6 +5,7 @@ + \ No newline at end of file diff --git a/README.md b/README.md index cdcf86f..9e4fce5 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,16 @@ For each of the issues above, screenshot and add the error images to this repo n Your answers to this exercise should be added using Markdown into the project's `README.md` file so that they get committed with the project's code.. --- +### **The errors I received are as follows:** +**Error #1:** +![Error001](Error001.png) +**Error #2:** +![Error002](Error002.png) + +**Error #3:** +![Error003](Error003.png) +--- ## Part 2: Celsius to Fahrenheit Converter **Objective:** diff --git a/src/TempConvert.java b/src/TempConvert.java new file mode 100644 index 0000000..8942d7b --- /dev/null +++ b/src/TempConvert.java @@ -0,0 +1,17 @@ +import java.util.Scanner; + +public class TempConvert { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + double numberInCelcius; + double numberInFahrenheit; + + //Prompt user for number in Celsius and store value + System.out.print("Enter a number in Celsius: "); + numberInCelcius = in.nextDouble(); + + //Convert number to Fahrenheit and print result + numberInFahrenheit = numberInCelcius * 9/5 + 32; + System.out.printf("%.1f C = %.1f F", numberInCelcius, numberInFahrenheit); + } +} \ No newline at end of file diff --git a/src/TimeConverter.java b/src/TimeConverter.java new file mode 100644 index 0000000..9129ada --- /dev/null +++ b/src/TimeConverter.java @@ -0,0 +1,21 @@ +import java.util.Scanner; + +public class TimeConverter{ + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + + //Prompt user for input + System.out.print("Enter a total number of seconds: "); + + //Read an integer from keyboard + int totalSeconds = in.nextInt(); + + //Calculate results + int hours = totalSeconds / 3600; + int minutes = (totalSeconds % 3600) / 60; + int seconds = totalSeconds % 60; + + //Display output of calculations + System.out.printf("%d seconds = %d hours, %d minutes, and %d seconds\n", totalSeconds, hours, minutes, seconds); + } +} \ No newline at end of file