forked from johnrogers104/PointOfSaleSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSalesLineItem.java
33 lines (27 loc) · 938 Bytes
/
SalesLineItem.java
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
package ProcessSale;
// Class to hold info for a product in the cart
public class SalesLineItem {
//variables
int quantity;
ProductDescription desc;
//constructor
//pass in the id/barcode of the current lineitem
public SalesLineItem(String barcode, int qty){
desc = new ProductDescription(barcode);
quantity = qty;
}
//method to get the subtotal of the purchase after adding this current item
//to the sale
public int getSubtotal(){
//take in id of saleslineitem from productdescription and return the
//price of that lineitem added to the current total
int price = desc.getPrice();
//Adjust the price based on the number of the same items
int subTotal = price * quantity;
return subTotal;
}
// Get the price of the item
public double getPrice() {
return desc.getPrice();
}
}