a
This commit is contained in:
@@ -1,2 +1,95 @@
|
||||
package EidP_BP_3;public class Boot {
|
||||
package EidP_BP_3;
|
||||
|
||||
public class Boot {
|
||||
String BootsName;
|
||||
int BootsId, AnzahlPassagiere, AnzahlPersonal, AnzahlMeilen;
|
||||
|
||||
public String getBootsName() {
|
||||
return BootsName;
|
||||
}
|
||||
|
||||
public void setBootsName(String bootsName) {
|
||||
BootsName = bootsName;
|
||||
}
|
||||
|
||||
public int getBootsId() {
|
||||
return BootsId;
|
||||
}
|
||||
|
||||
public void setBootsId(int bootsId) {
|
||||
BootsId = bootsId;
|
||||
}
|
||||
|
||||
public int getAnzahlPassagiere() {
|
||||
return AnzahlPassagiere;
|
||||
}
|
||||
|
||||
public void setAnzahlPassagiere(int anzahlPassagiere) {
|
||||
AnzahlPassagiere = anzahlPassagiere;
|
||||
}
|
||||
|
||||
public int getAnzahlPersonal() {
|
||||
return AnzahlPersonal;
|
||||
}
|
||||
|
||||
public void setAnzahlPersonal(int anzahlPersonal) {
|
||||
AnzahlPersonal = anzahlPersonal;
|
||||
}
|
||||
|
||||
public int getAnzahlMeilen() {
|
||||
return AnzahlMeilen;
|
||||
}
|
||||
|
||||
public void setAnzahlMeilen(int anzahlMeilen) {
|
||||
AnzahlMeilen = anzahlMeilen;
|
||||
}
|
||||
|
||||
public double getTreibstoff() {
|
||||
return Treibstoff;
|
||||
}
|
||||
|
||||
public void setTreibstoff(double treibstoff) {
|
||||
Treibstoff = treibstoff;
|
||||
}
|
||||
|
||||
public double getVerbrauchProMeile() {
|
||||
return VerbrauchProMeile;
|
||||
}
|
||||
|
||||
public void setVerbrauchProMeile(double verbrauchProMeile) {
|
||||
VerbrauchProMeile = verbrauchProMeile;
|
||||
}
|
||||
|
||||
double Treibstoff, VerbrauchProMeile;
|
||||
|
||||
boolean fahreMeilen(int Meilen){
|
||||
if(VerbrauchProMeile * Meilen <= Treibstoff){
|
||||
AnzahlMeilen -= Meilen;
|
||||
Treibstoff -= VerbrauchProMeile * Meilen;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean fuegePersonHinzu(boolean istPassagier){
|
||||
if( istPassagier && AnzahlPersonal*10<= AnzahlPassagiere + 1){
|
||||
AnzahlPassagiere++;
|
||||
return true;
|
||||
} else if ((!istPassagier) &&( AnzahlPersonal +1 <= AnzahlPassagiere)) {
|
||||
AnzahlPersonal++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Boot(String pBootsName, double pTreibstoff, double pVerbrauchProMeile, int pAnzahlMeilen, int pAnzahlPersonal, int pAnzahlPassagiere){
|
||||
BootsName = pBootsName;
|
||||
BootsId = this.hashCode();
|
||||
AnzahlPersonal = pAnzahlPersonal;
|
||||
AnzahlPassagiere = pAnzahlPassagiere;
|
||||
Treibstoff = pTreibstoff;
|
||||
VerbrauchProMeile = pVerbrauchProMeile;
|
||||
AnzahlMeilen = pAnzahlMeilen;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user