Package Items
Class Order
java.lang.Object
Items.Order
This class handles the Order Item.
- Since:
- 2023-03-07
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringStringholding the name of the customer who made the orderprivate final LocalDateTimeLocalDateTimeholding the current dateprivate longIdentification number of the employee who created the orderMapholding each item's name as a key and its coresponding quantity as value.private longIndentification number of the orderprivate doubleTotal cost of the order -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an item to the orderGetscustomerNamegetDate()GetsdatelongGetsemployeeIdUpdate GUI to current item countlonggetItemCount(String name) Gets the number of an item withinitemsgetItems()GetsitemslongGetsorderIDdoubleGetstotalCostvoidremoveItem(String name, double price) Removes an item from the ordervoidsetCustomerName(String name) SetscustomerNamevoidsetOrderId(long orderID) SetsorderID
-
Field Details
-
orderID
private long orderIDIndentification number of the order -
customerName
Stringholding the name of the customer who made the order -
date
LocalDateTimeholding the current date -
totalCost
private double totalCostTotal cost of the order -
employeeId
private long employeeIdIdentification number of the employee who created the order -
items
Mapholding each item's name as a key and its coresponding quantity as value.
-
-
Constructor Details
-
Order
public Order()Construct an Order -
Order
public Order(long employeeId) Construct an Order- Parameters:
employeeId- ID number of the Employee completing the order
-
Order
public Order(long employeeId, long orderId) Construct an Order- Parameters:
employeeId- ID number of the Employee completing the orderorderId- ID number of the Order
-
-
Method Details
-
addItem
Add an item to the order- Parameters:
name- of the item to add as aStringprice- of the item
-
removeItem
Removes an item from the order- Parameters:
name- of the item to remove as aStringprice- of the item
-
setCustomerName
SetscustomerName- Parameters:
name- newcustomerName
-
getCustomerName
GetscustomerName- Returns:
customerName
-
getEmployeeId
public long getEmployeeId()GetsemployeeId- Returns:
employeeId
-
setOrderId
public void setOrderId(long orderID) SetsorderID- Parameters:
orderID- new identification number of the order
-
getOrderID
public long getOrderID()GetsorderID- Returns:
orderID
-
getDate
Getsdate- Returns:
date
-
getTotalCost
public double getTotalCost()GetstotalCost- Returns:
totalCost
-
getItemCount
Gets the number of an item withinitems- Parameters:
name- of the item as aString- Returns:
- amount of the item
-
getItemCount
Update GUI to current item count- Returns:
- updated count as
String
-
getItems
Getsitems- Returns:
items
-