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 40 41 42 43
|
package edu.bordeaux.domaine;
public class Movie {
private final String title;
private final int dateSortie;
private final double price;
private final int quantity;
public Movie(final String title, final int dateSortie, final double price, final int quantity) {
this.title = title;
this.dateSortie = dateSortie;
this.price = price;
this.quantity = quantity;
}
public String getTitle() {
return title;
}
public int getDateSortie() {
return dateSortie;
}
public double getPrice() {
return price;
}
public int getQuantity() {
return quantity;
}
public void display() {
// The Imitation Game, sorti en 2014, 2 exemplaires à 14.99 euros, total : 29.98 euros
System.out.println(this.getTitle() + ", sorti en " + this.getDateSortie() + ", " + this.getQuantity() + " exemplaires à "
+ this.getPrice() + " euros, total : " + this.getTotalPrice() + " euros");
}
public double getTotalPrice() {
return this.getPrice() * this.getQuantity();
}
} |