diff --git a/src/main/java/Unit5/U5_L2_Activity_Four.java b/src/main/java/Unit5/U5_L2_Activity_Four.java new file mode 100644 index 0000000..97dee48 --- /dev/null +++ b/src/main/java/Unit5/U5_L2_Activity_Four.java @@ -0,0 +1,28 @@ +package Unit5; + +// Have to get rid of package statement + +public class U5_L2_Activity_Four { + public static void coinConverter(int cents) { + int dollars = cents / 100; + cents %= 100; + int quarters = cents / 25; + cents %= 25; + int dimes = cents / 10; + cents %= 10; + int nickels = cents / 5; + cents %= 5; + int pennies = cents; + + System.out.println("Dollar Bills: " + dollars + "\r\n" + // + "Quarters: " + quarters + "\r\n" + // + "Dimes: " + dimes + "\r\n" + // + "Nickels: " + nickels + "\r\n" + // + "Pennies: " + pennies); + + } + + // public static void main(String[] args) { + // coinConverter(1234); + // } +} diff --git a/src/main/java/Unit5/U5_L2_Activity_One.java b/src/main/java/Unit5/U5_L2_Activity_One.java new file mode 100644 index 0000000..18deb61 --- /dev/null +++ b/src/main/java/Unit5/U5_L2_Activity_One.java @@ -0,0 +1,25 @@ +package Unit5; + +// Have to get rid of package statement + +public class U5_L2_Activity_One { + public static void timeOfDay(int hour) { + if (hour == 0) { + System.out.println("midnight"); + } else if (hour < 12) { + System.out.println("morning"); + } else if (hour == 12) { + System.out.println("noon"); + } else if (hour < 18) { + System.out.println("afternoon"); + } else if (hour == 18) { + System.out.println("dusk"); + } else if (hour < 24) { + System.out.println("evening"); + } + } + + // public static void main(String[] args) { + + // } +} diff --git a/src/main/java/Unit5/U5_L2_Activity_Three.java b/src/main/java/Unit5/U5_L2_Activity_Three.java new file mode 100644 index 0000000..e34555c --- /dev/null +++ b/src/main/java/Unit5/U5_L2_Activity_Three.java @@ -0,0 +1,15 @@ +package Unit5; + +// Have to get rid of package statement + +public class U5_L2_Activity_Three { + public static void printDouble(double n, int times) { + for (int i = 0; i < times; i++) { + System.out.println(n); + } + } + + // public static void main(String[] args) { + // printDouble(2.5, 2); + // } +} diff --git a/src/main/java/Unit5/U5_L2_Activity_Two.java b/src/main/java/Unit5/U5_L2_Activity_Two.java new file mode 100644 index 0000000..a7b3cdf --- /dev/null +++ b/src/main/java/Unit5/U5_L2_Activity_Two.java @@ -0,0 +1,16 @@ +package Unit5; + +// Have to get rid of package statement + +public class U5_L2_Activity_Two { + public static void reverser(String word) { + + for (int i = word.length() - 1; i >= 0; i--) { + System.out.print(word.substring(i, i + 1)); + } + } + + // public static void main(String[] args) { + // reverser("abcde"); + // } +}