diff --git a/401kAllocationTool/.idea/vcs.xml b/401kAllocationTool/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/401kAllocationTool/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/401kAllocationTool/src/com/company/Main.java b/401kAllocationTool/src/com/company/Main.java new file mode 100644 index 0000000..89664c8 --- /dev/null +++ b/401kAllocationTool/src/com/company/Main.java @@ -0,0 +1,10 @@ +package com.company; + +public class Main +{ + + public static void main(String[] args) + { + + } +} diff --git a/QueueExample/src/QueueExample.java b/QueueExample/src/QueueExample.java new file mode 100644 index 0000000..378fd03 --- /dev/null +++ b/QueueExample/src/QueueExample.java @@ -0,0 +1,4 @@ +public class QueueExample +{ + +} diff --git a/ch04/HelloMethod.java b/ch04/HelloMethod.java new file mode 100644 index 0000000..1b43e30 --- /dev/null +++ b/ch04/HelloMethod.java @@ -0,0 +1,38 @@ +public class HelloMethod +{ + public static void main(String[] args) + { + String firstName = "Fred"; + String secondName = "Wilma"; + String lastName = "Flintstone"; + + printHelloWorld(firstName, lastName); + printHelloWorld(secondName, lastName); + + int firstNum = 5; + int secondNum = 10; + printOhNo(firstName, firstNum, secondNum, false); + + printNumberNoSign(5); + printNumberNoSign(-5); + } + + public static void printNumberNoSign (int number) + { + int positiveNumber = Math.abs(number); + System.out.println("The number is " + positiveNumber); + } + + public static void printHelloWorld(String fName, String lName) + { + System.out.println("Hello, World " + fName + " " + lName + "."); + } + + public static void printOhNo(String cat, int firstNumber, int secondNumber, boolean isAPerson) + { + System.out.println("Oh no!"); + System.out.println("First Number is " + firstNumber); + System.out.println("Second Number is " + secondNumber); + System.out.println("Total is " + (firstNumber + secondNumber)); + } +} diff --git a/ch05/.idea/vcs.xml b/ch05/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/ch05/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ch05/CrazyEdCheese.java b/ch05/CrazyEdCheese.java new file mode 100644 index 0000000..6437aa5 --- /dev/null +++ b/ch05/CrazyEdCheese.java @@ -0,0 +1,93 @@ +import java.util.Scanner; + +public class CrazyEdCheese +{ + public static void main(String[] args) + { + Scanner scanner = new Scanner(System.in); + int cheeseDiameter, cheeseYardage; + + System.out.println("======================================================="); + System.out.println("Welcome to Crazy Ed's Wholesale String Cheese Emporium!"); + System.out.println("======================================================="); + System.out.println(" "); + System.out.println("Pricing: 1 in. = $2 per yardage, $2 shipping per yardage, & FREE SHIPPING for yardage over 50 yards!!!"); + System.out.println("Pricing: 2 in. = $4 per yardage, $2 shipping per yardage, & FREE SHIPPING for yardage over 75 yards!!!"); + System.out.println("Pricing: 3 in. = $6 per yardage, $4 shipping per yardage, & FREE SHIPPING for yardage over 25 yards!!!"); + System.out.println("All prices include a $5 handling fee."); + System.out.println("To begin your order, please choose a diameter of string cheese; 1, 2, or 3: "); + + cheeseDiameter = scanner.nextInt(); + + if ((cheeseDiameter < 1) || (cheeseDiameter > 3)) + { + System.out.println("That order is just TOO CRAZY, even for me!!"); + } + + else + { + System.out.println("Please indicate the yardage of string cheese you would like to order: "); + } + + cheeseYardage = scanner.nextInt(); + + shippingCalculation(cheeseDiameter, cheeseYardage); + } + + public static void shippingCalculation(int cheeseDiameter, int cheeseYardage) + { + int cheeseYardageTotal, cheeseShipping; + + switch(cheeseDiameter) + { + case 1 : + { + if (cheeseYardage <= 50) + { + cheeseYardageTotal = ((cheeseYardage * 2) + (cheeseYardage * 2)); + cheeseShipping = cheeseYardageTotal + 5; + System.out.println("The total shipping for your order comes to: $" + cheeseShipping); + } + + else if (cheeseYardage > 50) + { + cheeseYardageTotal = (cheeseYardage * 2); + cheeseShipping = cheeseYardageTotal + 5; + System.out.println("The total shipping for your order comes to: $" + cheeseShipping); + } + } break; + + case 2 : + { + if (cheeseYardage <= 75) + { + cheeseYardageTotal = ((cheeseYardage * 4) + (cheeseYardage * 2)); + cheeseShipping = cheeseYardageTotal + 5; + System.out.println("The total shipping for your order comes to: $" + cheeseShipping); + } + else if (cheeseYardage > 75) + { + cheeseYardageTotal = (cheeseYardage * 4); + cheeseShipping = cheeseYardageTotal + 5; + System.out.println("The total shipping for your order comes to: $" + cheeseShipping); + } break; + } + + case 3 : + { + if (cheeseYardage <= 25) + { + cheeseYardageTotal = ((cheeseYardage * 6) + (cheeseYardage * 4)); + cheeseShipping = cheeseYardageTotal + 5; + System.out.println("The total shipping for your order comes to: $" + cheeseShipping); + } + else if (cheeseYardage > 25) + { + cheeseYardageTotal = (cheeseYardage * 6); + cheeseShipping = cheeseYardageTotal + 5; + System.out.println("The total shipping for your order comes to: $" + cheeseShipping); + } + } break; + } + } +}