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..24317d5 Binary files /dev/null and b/error01.png differ diff --git a/error02.png b/error02.png new file mode 100644 index 0000000..31ba3c1 Binary files /dev/null and b/error02.png differ diff --git a/error03.png b/error03.png new file mode 100644 index 0000000..652bba0 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..dda44ba --- /dev/null +++ b/src/TempConvert.java @@ -0,0 +1,12 @@ +import java.util.Scanner; +public class TempConvert { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + System.out.println("Enter a temperature in Celsius: "); + double C,F; + C=in.nextDouble(); + System.out.println("Enter a temperature in Celsius: " +C); + F= C*(9.0/5.0)+32; + System.out.printf("%.1f C = %.1f F", C, F); + } +} diff --git a/src/Time.java b/src/Time.java new file mode 100644 index 0000000..cacce18 --- /dev/null +++ b/src/Time.java @@ -0,0 +1,17 @@ +import java.util.Scanner; +public class Time { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + System.out.println("Enter a total number of seconds "); + final int SECONDS_PER_MINUTE=60; + final int MINUTES_PER_HOUR=60; + int totalSeconds, secondsE,hours, minutes, seconds; + totalSeconds=in.nextInt(); + System.out.println("Enter a total amount of seconds: " + totalSeconds); + secondsE=totalSeconds%(MINUTES_PER_HOUR*SECONDS_PER_MINUTE); + hours= totalSeconds/(MINUTES_PER_HOUR*SECONDS_PER_MINUTE); + minutes=secondsE/SECONDS_PER_MINUTE; + seconds=totalSeconds-(hours*SECONDS_PER_MINUTE*MINUTES_PER_HOUR)-(minutes*SECONDS_PER_MINUTE); + System.out.printf("%d seconds = %d hours %d minutes %d seconds", totalSeconds, hours, minutes,seconds ); + } +} \ No newline at end of file