Commit d3c13059 authored by Gaetan's avatar Gaetan

getBrand() et getPrice() dans la classe Vehicle

parent 05aadbeb
...@@ -26,6 +26,7 @@ public class Vehicle { ...@@ -26,6 +26,7 @@ public class Vehicle {
private GearBox gearBox; private GearBox gearBox;
private List<Brake> brakes; private List<Brake> brakes;
private Engine engine; private Engine engine;
private List<Option> options;
// Physic // Physic
private Double velocity; private Double velocity;
...@@ -112,13 +113,28 @@ public class Vehicle { ...@@ -112,13 +113,28 @@ public class Vehicle {
// Get the brand of the car // Get the brand of the car
// public VehicleBrand getBrand() public VehicleBrand getBrand(){return this.brand};
// Get the options of the car // Get the options of the car
// public List<vehicle.part.option> getOptions() // public List<vehicle.part.option> getOptions()
// Get the price // Get the price
// public Double getPrice(); public double getPrice(List<Option> options){
int index = 0;
double price = 0;
if (options.size() == 0) {
return price;
}
else{
while (index < options.size()){
price = options.Stream.forEach(o -> o.getPrice);
}
}
return price;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment