-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathBagel.java
More file actions
39 lines (32 loc) · 907 Bytes
/
Bagel.java
File metadata and controls
39 lines (32 loc) · 907 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
37
38
39
package com.booleanuk.core;
public class Bagel extends Item{
private Filling filling;
public Bagel(String variant, String sku){
super("Bagel", variant, sku);
}
public String getFillingSku(){
return filling.getSku();
}
public boolean gotFilling(){
if (filling != null){
return true;
}
return false;
}
public String getCombiSku(){
if (filling != null){
return super.getSku() + "-" + filling.getSku();
}
return getSku();
}
public boolean setFilling(Filling filling){
this.filling = filling;
return true;
}
@Override
public float getTotalCost(PriceList priceList){
if(this.gotFilling())
return priceList.getPrice(super.getSku()) + priceList.getPrice(filling.getSku());
return priceList.getPrice(super.getSku());
}
}