-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvoice.java
More file actions
36 lines (33 loc) · 932 Bytes
/
Copy pathInvoice.java
File metadata and controls
36 lines (33 loc) · 932 Bytes
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
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Invoice {
// To Create and Update Invoice
static int Id = 1;
static Map<Integer, Invoice> AllInvoices = new HashMap<>();
int InvoiceId;
int TotalPrice;
List<Product> ProductList;
public Invoice() {
this.InvoiceId = Id++;
this.ProductList = new ArrayList<>();
this.TotalPrice = 0;
}
public static void ShowInvoiceDetails(Invoice userInvoice) {
System.out.println(
"InvoiceId "
+ userInvoice.InvoiceId
+ ", TotalPurchase "
+ userInvoice.TotalPrice
+ "\nProducts:");
for (Product userProduct : userInvoice.ProductList) {
System.out.println(
userProduct.ProductName
+ " : "
+ userProduct.ProductPrice
+ " x "
+ userProduct.ProductCount);
}
}
}