|
| 1 | +public static void Main(String[] args) { |
| 2 | + Address a1 = new Address(2, 3, "Lahijan"); |
| 3 | + Address a2 = new Address(5, 6, "Tehran"); |
| 4 | + |
| 5 | + System.out.println("\n--------------------------------------\n"); |
| 6 | + System.out.println("Distance From Address a1 to a2 is: " + a1.distanceFrom(a2)); |
| 7 | + System.out.println("\n--------------------------------------\n"); |
| 8 | + |
| 9 | + Customer c1 = new Customer("MAMAD", a1); |
| 10 | + Customer c2 = new Customer("ALI", a2); |
| 11 | + |
| 12 | + System.out.println("First Customer's ID: " + c1.getCustomerNumber()); |
| 13 | + System.out.println("Second Customer's ID: " + c2.getCustomerNumber()); |
| 14 | + |
| 15 | + Food f1 = new Food("BURGER", 130); |
| 16 | + Food f2 = new Food("PIZZA", 200); |
| 17 | + Food f3 = new Food("PASTA", 110); |
| 18 | + |
| 19 | + System.out.println("\n--------------------------------------\n"); |
| 20 | + |
| 21 | + for (int i = 0; i < Food.getMenu().size(); i++) { |
| 22 | + System.out.println("Food Name: " + Food.getMenu().get(i).getName()); |
| 23 | + } |
| 24 | + |
| 25 | + System.out.println("\n--------------------------------------\n"); |
| 26 | + |
| 27 | + Item it1 = new Item(f1, 2); |
| 28 | + Item it2 = new Item(f2, 3, "MORE SAUCE"); |
| 29 | + Item it3 = new Item(f3, 1); |
| 30 | + |
| 31 | + Invoice inv = new Invoice(c1); |
| 32 | + |
| 33 | + if (inv.addItem(it1) && inv.addItem(it2)) System.out.println("Items added successfully"); |
| 34 | + else System.out.println("Items could not be added"); |
| 35 | + |
| 36 | + if (inv.removeItem(it3)) System.out.println("Item removed successfully"); |
| 37 | + else System.out.println("Failed to remove item (item doesn't exist in invoice)"); |
| 38 | + |
| 39 | + inv.nextStage(); |
| 40 | + |
| 41 | + System.out.println("Current state: " + inv.getState()); |
| 42 | + |
| 43 | + System.out.println("\n--------------------------------------\n"); |
| 44 | + |
| 45 | + for (int i = 0; i < inv.getItems().size(); i++) { |
| 46 | + Item it = inv.getItems().get(i); |
| 47 | + System.out.println("Food Name: " + it.getFood().getName() + " | Food Description: " + it.getDescription()); |
| 48 | + } |
| 49 | + |
| 50 | + System.out.println("Total price: " + inv.getTotalPrice()); |
| 51 | +} |
0 commit comments