diff --git a/.idea/misc.xml b/.idea/misc.xml index 639900d..47478b9 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file 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/error01.PNG b/error01.PNG new file mode 100644 index 0000000..2882ad5 Binary files /dev/null and b/error01.PNG differ diff --git a/error02.PNG b/error02.PNG new file mode 100644 index 0000000..383058c Binary files /dev/null and b/error02.PNG differ diff --git a/error03.PNG b/error03.PNG new file mode 100644 index 0000000..c9fabe0 Binary files /dev/null and b/error03.PNG differ diff --git a/src/TempConvert.java b/src/TempConvert.java new file mode 100644 index 0000000..1bc3077 --- /dev/null +++ b/src/TempConvert.java @@ -0,0 +1,15 @@ +import java.util.Scanner; +public class TempConvert { + public static void main(String[] args) { + System.out.print("Enter a temperature in Celsius: "); + + Scanner scanner = new Scanner(System.in); + double celsius = scanner.nextDouble(); + + double fahrenheit = celsius * 9/5 + 32; + + System.out.printf("%.1f C = %.1f F\n", celsius, fahrenheit); + + scanner.close(); + } +} \ No newline at end of file diff --git a/src/TimeConvert.java b/src/TimeConvert.java new file mode 100644 index 0000000..1efe454 --- /dev/null +++ b/src/TimeConvert.java @@ -0,0 +1,18 @@ +import java.util.Scanner; +public class TimeConvert { + public static void main(String[] args) { + System.out.print("Enter a total number of seconds: "); + + Scanner scanner = new Scanner(System.in); + int totalSeconds = scanner.nextInt(); + + int hours = totalSeconds / 3600; + int minutes = (totalSeconds % 3600) / 60; + int seconds = totalSeconds % 60; + + System.out.printf("%d seconds = %d hours, %d minutes, and %d seconds\n", + totalSeconds, hours, minutes, seconds); + + scanner.close(); + } +}