-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPetrolPurchase.java
More file actions
54 lines (39 loc) · 1.36 KB
/
PetrolPurchase.java
File metadata and controls
54 lines (39 loc) · 1.36 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 PetrolPurchase{
private String location;
private String typeOfPetrol;
private int quantity;
private double pricePerLiter;
private double discount;
public PetrolPurchase(String location, String typeOfPetrol, int quantity, double pricePerLiter, double discount){
this.location = location;
this.typeOfPetrol = typeOfPetrol;
this.quantity = quantity;
this.pricePerLiter = pricePerLiter;
this.discount = discount; }
public void setLocation(String location){
this.location = location; }
public void setTypeOfPetrol(String typeOfPetrol){
this.typeOfPetrol = typeOfPetrol; }
public void setQuantity(int quantity){
this.quantity = quantity; }
public void setPricePerLiter(double pricePerLiter){
this.pricePerLiter = pricePerLiter; }
public void setDiscount(double discount){
this.discount = discount; }
public String getLocation(){
return location; }
public String getTypeOfPetrol(){
return typeOfPetrol; }
public int getQuantity(){
return quantity; }
public double getPricePerLiter(){
return pricePerLiter; }
public double getDiscount(){
double discount = 0.40 * getPricePerLiter();
return discount; }
public double getPurchaseAmount(){
double purchaseAmount = getNetPurchase() - getDiscount();
return purchaseAmount; }
public double getNetPurchaseAmount(); {
double netPurchase = getQuantity() * pricePerLiter();
}