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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,2 +1,32 @@
|
||||
package EidP_BP_3;public class BootsTest {
|
||||
package EidP_BP_3;
|
||||
|
||||
public class BootsTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Boot helgoland = new Boot("helgoland", 5000, 100,2000, 50,500);
|
||||
Boot sylt = new Boot("sylt",500,10,2500,7,50);
|
||||
Boot ronsby = new Boot("ronsby", 5000, 10,2500,22,100);
|
||||
|
||||
System.out.println(helgoland.fahreMeilen(2000));
|
||||
System.out.println(sylt.fahreMeilen(2500));
|
||||
System.out.println(ronsby.fahreMeilen(2500));
|
||||
|
||||
helgoland.setAnzahlPassagiere(helgoland.getAnzahlPassagiere()+200);
|
||||
helgoland.setAnzahlPersonal(helgoland.getAnzahlPersonal()+50);
|
||||
|
||||
sylt.setAnzahlPassagiere(sylt.getAnzahlPassagiere()+200);
|
||||
sylt.setAnzahlPersonal(sylt.getAnzahlPersonal()+50);
|
||||
|
||||
ronsby.setAnzahlPassagiere(ronsby.getAnzahlPassagiere()+200);
|
||||
ronsby.setAnzahlPersonal(ronsby.getAnzahlPersonal()+50);
|
||||
|
||||
|
||||
System.out.println(helgoland.getBootsName()+ " " + helgoland.getAnzahlPassagiere() + " " + helgoland.getAnzahlPersonal() +" "+helgoland.getTreibstoff() );
|
||||
|
||||
System.out.println(sylt.getBootsName()+ " " + sylt.getAnzahlPassagiere() + " " + sylt.getAnzahlPersonal() +" "+sylt.getTreibstoff() );
|
||||
|
||||
System.out.println(ronsby.getBootsName()+ " " + ronsby.getAnzahlPassagiere() + " " + ronsby.getAnzahlPersonal() +" "+ronsby.getTreibstoff() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
8
BP/out/production/BP/.idea/.gitignore
generated
vendored
Normal file
8
BP/out/production/BP/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
6
BP/out/production/BP/.idea/misc.xml
generated
Normal file
6
BP/out/production/BP/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
BP/out/production/BP/.idea/modules.xml
generated
Normal file
8
BP/out/production/BP/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/BP.iml" filepath="$PROJECT_DIR$/BP.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
BP/out/production/BP/.idea/vcs.xml
generated
Normal file
6
BP/out/production/BP/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
11
BP/out/production/BP/BP.iml
Normal file
11
BP/out/production/BP/BP.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
BIN
BP/out/production/BP/EidP_BP_3/Boot.class
Normal file
BIN
BP/out/production/BP/EidP_BP_3/Boot.class
Normal file
Binary file not shown.
BIN
BP/out/production/BP/EidP_BP_3/BootsTest.class
Normal file
BIN
BP/out/production/BP/EidP_BP_3/BootsTest.class
Normal file
Binary file not shown.
BIN
BP/out/production/BP/GKD.class
Normal file
BIN
BP/out/production/BP/GKD.class
Normal file
Binary file not shown.
6
EidP/.idea/vcs.xml
generated
Normal file
6
EidP/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
6
EidP/out/production/EidP/.idea/vcs.xml
generated
Normal file
6
EidP/out/production/EidP/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Reference in New Issue
Block a user