ajout de prix pour les Part

This commit is contained in:
Rochas
2024-12-20 11:00:53 +01:00
parent 6c60549cfe
commit 42dce975ad
8 changed files with 201 additions and 98 deletions

View File

@@ -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());
}
}