This commit is contained in:
2022-12-14 11:50:24 +01:00
parent 10b05a1a9e
commit e623a802e4
12 changed files with 176 additions and 2 deletions

View File

@@ -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;
}
}

View File

@@ -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
View 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
View 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
View 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
View 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>

View 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>

Binary file not shown.

Binary file not shown.

Binary file not shown.

6
EidP/.idea/vcs.xml generated Normal file
View 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
View 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>