ajout de prix pour les Part
This commit is contained in:
@@ -1,11 +1,22 @@
|
||||
package src.fr.impl.Parts;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import src.fr.api.PartType;
|
||||
import src.fr.impl.PartImpl;
|
||||
|
||||
public class Exterior extends PartImpl {
|
||||
|
||||
private static final HashMap<String,Integer> prices;
|
||||
static {
|
||||
prices = new HashMap<>();
|
||||
prices.put("XC",0);
|
||||
prices.put("XM",800);
|
||||
prices.put("XS",10000);
|
||||
}
|
||||
|
||||
private static final Set<String> colorSet;
|
||||
static {
|
||||
colorSet = new HashSet<>();
|
||||
@@ -39,4 +50,10 @@ public class Exterior extends PartImpl {
|
||||
public void setColor(String newColor){
|
||||
this.color = newColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(PartType type){
|
||||
this.type = type;
|
||||
this.price = prices.get(type.getName());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user