diff --git a/.idea/misc.xml b/.idea/misc.xml index 639900d..172df7b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Error01.png b/Error01.png new file mode 100644 index 0000000..85968af Binary files /dev/null and b/Error01.png differ diff --git a/Error02.png b/Error02.png new file mode 100644 index 0000000..45c0516 Binary files /dev/null and b/Error02.png differ diff --git a/Error03.png b/Error03.png new file mode 100644 index 0000000..b9645e4 Binary files /dev/null and b/Error03.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/src/SecondsConvert.java b/src/SecondsConvert.java new file mode 100644 index 0000000..9c89f32 --- /dev/null +++ b/src/SecondsConvert.java @@ -0,0 +1,19 @@ +import java.util.Scanner; + +public class SecondsConvert { + + public static void main(String[] args) { + int hours, minutes, seconds; + final int CONVERSION = 60; + Scanner in = new Scanner(System.in); + + System.out.print("Enter your amount of seconds: "); + seconds = in.nextInt(); + + minutes = seconds / CONVERSION; + hours = minutes / CONVERSION; + minutes = minutes % CONVERSION; + seconds = seconds % CONVERSION; + System.out.printf("%d hours %d minutes %d seconds", hours, minutes, seconds); + } +} diff --git a/src/TempConvert.java b/src/TempConvert.java new file mode 100644 index 0000000..b7ac8a8 --- /dev/null +++ b/src/TempConvert.java @@ -0,0 +1,11 @@ +import java.util.Scanner; +public class TempConvert { + public static void main(String[] args) { + double Celsius; + Scanner in = new Scanner(System.in); + + System.out.print("Enter a temperature in Celsius: "); + Celsius = in.nextDouble(); + System.out.printf("%.1fC = %.1fF", Celsius, (Celsius * 9/5 + 32)); + } +}