Add initial project structure with instrument classes and Gradle setup
This commit is contained in:
@ -0,0 +1,64 @@
|
||||
package net.itsthesky.projetbut2.qualdev.model;
|
||||
|
||||
/**
|
||||
* Classe abstraite représentant un instrument de musique.
|
||||
*/
|
||||
public abstract class Instrument {
|
||||
|
||||
private final String serialNumber;
|
||||
private final InstrumentSpec instrumentSpec;
|
||||
private double price;
|
||||
|
||||
/**
|
||||
* Constructeur d'un instrument.
|
||||
* @param serialNumber le numéro de série de l'instrument
|
||||
* @param price le prix de l'instrument
|
||||
* @param instrumentSpec les spécifications de l'instrument
|
||||
*/
|
||||
public Instrument(String serialNumber, double price, InstrumentSpec instrumentSpec) {
|
||||
this.serialNumber = serialNumber;
|
||||
this.instrumentSpec = instrumentSpec;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère le numéro de série de l'instrument.
|
||||
* @return le numéro de série
|
||||
*/
|
||||
public String getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les spécifications de l'instrument.
|
||||
* @return les spécifications
|
||||
*/
|
||||
public InstrumentSpec getInstrumentSpec() {
|
||||
return instrumentSpec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère le prix de l'instrument.
|
||||
* @return le prix
|
||||
*/
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifie le prix de l'instrument.
|
||||
* @param price le nouveau prix
|
||||
*/
|
||||
public void setPrice(double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Instrument{" +
|
||||
"serialNumber='" + serialNumber + '\'' +
|
||||
", instrumentSpec=" + instrumentSpec +
|
||||
", price=" + price +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user