-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvoice.java
More file actions
54 lines (47 loc) · 1.3 KB
/
Invoice.java
File metadata and controls
54 lines (47 loc) · 1.3 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
public class Invoice {
private String partNumber;
private String partDescription;
private int quantityPurchased;
private double pricePerItem;
public Invoice(String partNumber, String partDescription, int quantityPurchased, double pricePerItem){
this.partNumber = partNumber;
this.partDescription = partDescription;
this.quantityPurchased = quantityPurchased;
this.pricePerItem = pricePerItem;
}
//Set & get method for PartNumber
public void setpartNumber(String partNumber) {
this.partNumber = partNumber;
}
public void setpartDescription(String partDescription) {
this.partDescription = partDescription;
}
public void setquantityPurchased(int quantityPurchase) {
this.quantityPurchased = quantityPurchased;
}
public void setpricePerItem(double pricePerItem) {
this.pricePerItem = pricePerItem;
}
public String getPartNumber() {
return partNumber;
}
public String getPartDescription() {
return partDescription;
}
public int getQuantityPurchased() {
return quantityPurchased;
}
public double getPricePerItem() {
return pricePerItem;
}
public double getInvoiceAmount() {
if (quantityPurchased < 0) {
quantityPurchased = 0;
}
if(pricePerItem < 0) {
pricePerItem = 0.0;
}
double invoiceAmount = pricePerItem * quantityPurchased;
return invoiceAmount;
}
}