-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestProject.java
More file actions
86 lines (65 loc) · 3.83 KB
/
testProject.java
File metadata and controls
86 lines (65 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
public class testProject {
public static void main(String [] args) {
/*
-----------------------------------------------------------------------------------------------------------------------------------------
Create new customer
Customer(int customerId, String customerName , String customerEmail, String customerPassword, String creditCardNumber)
-----------------------------------------------------------------------------------------------------------------------------------------
*/
Customer customer1 = new Customer(201, "Conor Duggan", "conor.duggan@ul.ie", "password", "123456789");
// Display Customer data
System.out.println("\nCustomer Created Info");
System.out.println("--------------------------------");
System.out.println("Customer ID: " + customer1.getCustomerId());
System.out.println("Customer Name: " + customer1.getCustomerName());
System.out.println("Customer Email: " + customer1.getCustomerEmail());
System.out.println("Customer Password: " + customer1.getCustomerPassword());
System.out.println("Customer Card No. : " + customer1.getCreditCardNumber());
System.out.println("\n\n\n");
/*
-----------------------------------------------------------------------------------------------------------------------------------------
Create New Product
Product(int productId, String productName, int stock, double unitCost, boolean isActive, boolean isProductDiscount)
-----------------------------------------------------------------------------------------------------------------------------------------
*/
Product product1 = new Product(40023, "CPU 1", 37, 99.99, true, false);
// Display Product data
System.out.println("\nProduct Created Info");
System.out.println("--------------------------------");
System.out.println("Product ID: " + product1.getProductId());
System.out.println("Product Name: " + product1.getProductName());
System.out.println("Product Stock: " + product1.getStock());
System.out.println("Product Unit Cost: " + product1.getUnitCost());
System.out.println("Product Status: " + product1.getProductStatus());
System.out.println("\n\n\n");
/*
-----------------------------------------------------------------------------------------------------------------------------------------
Create New Order
Order(int orderId, int customerId, String customerName, int shippingId, int [] productId, String [] productName, double [] unitCost)
-----------------------------------------------------------------------------------------------------------------------------------------
*/
// Get info to create Order from Customer and Product
int customerId = customer1.getCustomerId();
String customerName = customer1.getCustomerName();
int [] productId = {product1.getProductId()};
String [] productName = {product1.getProductName()};
double [] unitCost = {product1.getUnitCost()};
Order order1 = new Order(54, customerId, customerName, 7623, productId, productName, unitCost);
// Add this new Order to the ArrayList of customers orders in the Customer class.
customer1.addToCustomersOrders(order1.getOrderId());
// Display Product data
System.out.println("\nOrder Created Info");
System.out.println("--------------------------------");
System.out.println(order1.getOrderDetails());
System.out.println(order1.getShippingInfo());
System.out.println("\n\n\n");
/*
-----------------------------------------------------------------------------------------------------------------------------------------
Add the created order to ArrayList of customerOrders in Customer class.
-----------------------------------------------------------------------------------------------------------------------------------------
*/
System.out.println("\nCustomers Order ID list");
System.out.println("--------------------------------");
System.out.println(customer1.getCustomersOrders());
}
}