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/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/Lab003a.png b/src/Lab003a.png new file mode 100644 index 0000000..b18d4ea Binary files /dev/null and b/src/Lab003a.png differ diff --git a/src/Lab003b.png b/src/Lab003b.png new file mode 100644 index 0000000..73f42ed Binary files /dev/null and b/src/Lab003b.png differ diff --git a/src/Lab003c.png b/src/Lab003c.png new file mode 100644 index 0000000..7aae23f Binary files /dev/null and b/src/Lab003c.png differ diff --git a/src/LabThree.java b/src/LabThree.java new file mode 100644 index 0000000..c70bf6c --- /dev/null +++ b/src/LabThree.java @@ -0,0 +1,36 @@ +import java.io.OutputStream; + +public class LabThree { + + public static void main(String[] args) { + int gallon = 1; + double liter = 3.78541; + int cup = 16; + double quart = 4.0; + double a,b, c; + a = 2.5; + b = 5.5; + c = 12.3; + float D = 22; + int E = 6/5; + System.out.printf("Half of b = "+b/2 + ); + System.out.println(); + float G = 4/3f; + System.out.printf("value : %.4f\n" , G); + System.out.printf("Four thirds = %.3f\n" , 4.0 / 3.0); + System.out.printf("percent of days gone = %.4f" , 33.0 /366.0); + System.out.println(); + System.out.printf( "I am ironman = %d", 666); + System.out.println(); + System.out.printf("%d Cup = %f Quart\n", cup, quart); + System.out.printf("%d Gallon = %f Liter", gallon, liter ); + System.out.println(); + int J = 42; + System.out.printf("this will work = %d %f",E, G); + + + + } +} + diff --git a/src/TempConvert.java b/src/TempConvert.java new file mode 100644 index 0000000..a4a07df --- /dev/null +++ b/src/TempConvert.java @@ -0,0 +1,12 @@ +import java.util.Scanner; + +public class TempConvert { + public static void main(String[] args) { + System.out.printf("What is the temperature in Celsius?\n"); + Scanner scanner = new Scanner(System.in); + double celsius = scanner.nextDouble(); + double fahrenheit = ((celsius * 9/5) + 32); + System.out.printf("%.1f degrees Celsius is equal to %.1f degrees Fahrenheit\n", celsius, fahrenheit); + + } +} diff --git a/src/Time.java b/src/Time.java new file mode 100644 index 0000000..1cbdedf --- /dev/null +++ b/src/Time.java @@ -0,0 +1,15 @@ +import java.util.Scanner; + +public class Time { + public static void main(String[] args) { + + System.out.printf("Enter the total time in seconds:\n"); + 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", totalseconds, hours, minutes, seconds); + scanner.close(); + } +}