Skip to content
Snippets Groups Projects
Commit 978f07fe authored by Malori Alvarez's avatar Malori Alvarez
Browse files

TP8

parent 3330947a
No related branches found
No related tags found
No related merge requests found
File added
File added
package tp8;
public class Furniture implements IProduct, Comparable<Furniture> {
// Attributs
private String label;
private double price;
private static int XXX = 0;
// Constructeurs
public Furniture(String label, double price) {
this.label = label;
this.price = price;
}
public Furniture(double price) {
this.label = "refUnknown" + Furniture.XXX;
Furniture.XXX++;
this.price = price;
}
public double getPrice() {
return this.price;
}
public boolean isPerishable() {
return false;
}
}
\ No newline at end of file
package tp8;
import java.util.ArrayList;
public class Shelf{
private boolean refrigerated;
private int capacityMax;
private ArrayList<IProduct> products;
//Constructeur
public Shelf(boolean refrigerated, int capacityMax) {
this.refrigerated = refrigerated;
this.capacityMax = capacityMax;
this.products = new ArrayList<IProduct>();
}
public ArrayList<IProduct> getShelves() {
return this.products;
}
public boolean isFull(){
return this.products.size() >= this.capacityMax;
}
public boolean isRefrigerated() {
return this.refrigerated;
}
public String toString(){
return "[" + this.refrigerated + ":" + this.capacityMax + " -> " + this.products.size() + "]";
}
// Méthodes
public boolean add(IProduct p){
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment