fixed readme, added calculation

This commit is contained in:
Philipp 2020-11-09 19:37:41 +01:00
parent aeb6d3a4e8
commit 3b3e3fd084
7 changed files with 184 additions and 59 deletions

View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View file

@ -6,8 +6,14 @@
</artifacts-to-build>
</component>
<component name="ChangeListManager">
<list default="true" id="20f6192e-712c-4901-ab50-abe79c149ecf" name="Default Changelist" comment="">
<list default="true" id="20f6192e-712c-4901-ab50-abe79c149ecf" name="Default Changelist" comment="added calculation&#10;fixed readme error">
<change afterPath="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/autovermietung-int/autovermietung/Main.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/autovermietung-int/autovermietung/Main.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/autovermietung-int/autovermietung/helper/Shop.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/autovermietung-int/autovermietung/helper/Shop.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/autovermietung/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/autovermietung/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/autovermietung/helper/Shop.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/autovermietung/helper/Shop.java" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -22,14 +28,14 @@
<favorites_list name="autovermietung-int" />
</component>
<component name="FileEditorManager">
<splitter split-orientation="horizontal" split-proportion="0.48266166">
<splitter split-orientation="horizontal" split-proportion="0.38718793">
<split-first>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/autovermietung/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="702">
<caret line="89" column="66" selection-start-line="89" selection-start-column="66" selection-end-line="89" selection-end-column="66" />
<state relative-caret-position="306">
<caret line="18" column="23" selection-start-line="18" selection-start-column="23" selection-end-line="18" selection-end-column="23" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -40,8 +46,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Database.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1479">
<caret line="87" selection-start-line="87" selection-end-line="87" />
<state relative-caret-position="1275">
<caret line="141" selection-start-line="141" selection-end-line="141" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -49,15 +55,6 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="18" selection-start-line="18" selection-end-line="18" />
</state>
</provider>
</entry>
</file>
</leaf>
</split-first>
<split-second>
@ -65,7 +62,7 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Tastatur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="676">
<state relative-caret-position="1989">
<caret line="127" column="50" selection-start-line="127" selection-start-column="50" selection-end-line="127" selection-end-column="50" />
<folding>
<element signature="imports" expanded="true" />
@ -77,8 +74,8 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Shop.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2703">
<caret line="159" column="41" selection-start-line="159" selection-start-column="41" selection-end-line="159" selection-end-column="41" />
<state relative-caret-position="515">
<caret line="234" column="34" selection-start-line="234" selection-start-column="34" selection-end-line="234" selection-end-column="34" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -89,8 +86,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Pkw.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="816">
<caret line="68" column="22" selection-start-line="68" selection-start-column="22" selection-end-line="68" selection-end-column="22" />
<state relative-caret-position="357">
<caret line="21" column="3" selection-start-line="21" selection-start-column="3" selection-end-line="21" selection-end-column="3" />
</state>
</provider>
</entry>
@ -149,13 +146,19 @@
<option value="$PROJECT_DIR$/src/autovermietung/models/Kunde.java" />
<option value="$PROJECT_DIR$/src/autovermietung/helper/Tastatur.java" />
<option value="$PROJECT_DIR$/src/autovermietung/models/Pkw.java" />
<option value="$PROJECT_DIR$/src/autovermietung/Main.java" />
<option value="$PROJECT_DIR$/src/autovermietung/helper/Shop.java" />
<option value="$PROJECT_DIR$/src/autovermietung/helper/Database.java" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/src/autovermietung/Main.java" />
<option value="$PROJECT_DIR$/src/autovermietung/helper/Shop.java" />
</list>
</option>
</component>
<component name="MavenProjectNavigator">
<treeState>
<expand />
<select />
</treeState>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="497" />
<option name="y" value="-21" />
@ -169,6 +172,7 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
@ -228,7 +232,6 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@ -241,7 +244,7 @@
<property name="project.structure.last.edited" value="Artifacts" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="vcs.Git" />
<property name="settings.editor.selected.configurable" value="preferences.sourceCode.ZenUML" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
@ -305,26 +308,30 @@
</component>
<component name="ToolWindowManager">
<frame x="-8" y="22" width="2576" height="1426" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Favorites" order="0" sideWeight="0.50117373" side_tool="true" weight="0.15063593" />
<window_info id="Designer" order="1" />
<window_info active="true" content_ui="combo" id="Project" order="2" sideWeight="0.4988263" visible="true" weight="0.15302067" />
<window_info content_ui="combo" id="Project" order="2" sideWeight="0.4988263" visible="true" weight="0.15620032" />
<window_info id="Structure" order="3" sideWeight="0.5013123" side_tool="true" weight="0.15063593" />
<window_info id="simpleUML" order="4" show_stripe_button="false" weight="0.3298887" />
<window_info anchor="bottom" id="Sequence2" />
<window_info anchor="bottom" id="Terminal" order="0" weight="0.32992125" />
<window_info anchor="bottom" id="Event Log" order="1" sideWeight="0.50039744" side_tool="true" weight="0.20866142" />
<window_info anchor="bottom" id="Messages" order="2" weight="0.32913387" />
<window_info active="true" anchor="bottom" id="Messages" order="2" visible="true" weight="0.32913387" />
<window_info anchor="bottom" id="Message" order="3" />
<window_info anchor="bottom" id="Version Control" order="4" />
<window_info anchor="bottom" id="Find" order="5" weight="0.32992125" />
<window_info anchor="bottom" id="Run" order="6" sideWeight="0.49960256" visible="true" weight="0.20866142" />
<window_info anchor="bottom" id="Run" order="6" sideWeight="0.49960256" weight="0.20866142" />
<window_info anchor="bottom" id="Debug" order="7" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="8" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="9" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="10" weight="0.32913387" />
<window_info anchor="bottom" id="Log Analyzer" order="11" />
<window_info anchor="bottom" id="SOQL Query" order="12" weight="0.32913387" />
<window_info anchor="bottom" id="Anonymous Apex" order="13" />
<window_info anchor="right" id="Palette&#9;" order="0" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="1" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Maven" order="2" />
<window_info anchor="right" id="Maven" order="2" weight="0.3298887" />
<window_info anchor="right" id="Ant Build" order="3" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="4" weight="0.25" />
</layout>
@ -351,6 +358,10 @@
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="4" weight="0.25" />
</layout-to-restore>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="added calculation&#10;fixed readme error" />
<option name="LAST_COMMIT_MESSAGE" value="added calculation&#10;fixed readme error" />
</component>
<component name="editorHistoryManager">
<entry file="jar://$USER_HOME$/Downloads/oszimtJE.jar!/Tastatur.class">
<provider selected="true" editor-type-id="text-editor" />
@ -439,9 +450,24 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider editor-type-id="text-editor">
<state relative-caret-position="191">
<caret line="19" column="6" selection-start-line="19" selection-start-column="6" selection-end-line="19" selection-end-column="6" />
</state>
</provider>
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="289">
<caret line="17" column="3" selection-start-line="17" selection-start-column="3" selection-end-line="17" selection-end-column="3" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Tastatur.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="676">
<state relative-caret-position="1989">
<caret line="127" column="50" selection-start-line="127" selection-start-column="50" selection-end-line="127" selection-end-column="50" />
<folding>
<element signature="imports" expanded="true" />
@ -449,13 +475,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Pkw.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="816">
<caret line="68" column="22" selection-start-line="68" selection-start-column="22" selection-end-line="68" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Kunde.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="833">
@ -470,10 +489,43 @@
</state>
</provider>
</entry>
<entry file="file://$APPLICATION_CONFIG_DIR$/scratches/buffer1.zen">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor />
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$APPLICATION_CONFIG_DIR$/scratches/buffer2.zen">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor />
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/models/Pkw.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="21" column="3" selection-start-line="21" selection-start-column="3" selection-end-line="21" selection-end-column="3" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Database.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1275">
<caret line="141" selection-start-line="141" selection-end-line="141" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="702">
<caret line="89" column="66" selection-start-line="89" selection-start-column="66" selection-end-line="89" selection-end-column="66" />
<state relative-caret-position="306">
<caret line="18" column="23" selection-start-line="18" selection-start-column="23" selection-end-line="18" selection-end-column="23" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -482,31 +534,14 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Shop.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2703">
<caret line="159" column="41" selection-start-line="159" selection-start-column="41" selection-end-line="159" selection-end-column="41" />
<state relative-caret-position="515">
<caret line="234" column="34" selection-start-line="234" selection-start-column="34" selection-end-line="234" selection-end-column="34" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/autovermietung/helper/Database.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1479">
<caret line="87" selection-start-line="87" selection-end-line="87" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="18" selection-start-line="18" selection-end-line="18" />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
@ -583,4 +618,55 @@
</state>
</states>
</component>
<component name="simpleUML.UMLToolWindowPlugin">
<General>
<option name="birdViewUpdateDelay" value="2000" />
<option name="knownFile0" value="file://$PROJECT_DIR$/../Shop.suml" />
<option name="defaultFileLocation" value="file://$PROJECT_DIR$/.." />
</General>
<Classdiagram>
<option name="diagramTitleFont" value="SansSerif,1,12" />
<option name="diagramFont" value="SansSerif,0,10" />
<option name="defaultFieldsExpanded" value="false" />
<option name="defaultContructorsExpanded" value="false" />
<option name="defaultMethodsExpanded" value="false" />
<option name="showParameters" value="true" />
<option name="showTooltip" value="true" />
<option name="showReturnValues" value="true" />
<option name="longModifier" value="true" />
<option name="implementsBehaviour" value="1" />
<option name="extendsBehaviour" value="1" />
<option name="compartmentBehaviour" value="1" />
<option name="interfaceBackgroundColor" value="-6494306" />
<option name="abstractClassBackgroundColor" value="-1580132" />
<option name="classBackgroundColor" value="-6508057" />
<option name="diagramBackgroundColor" value="-1" />
<option name="useAntialiasedConnectors" value="true" />
<option name="quickSourceLinkColor" value="-16776961" />
<option name="quickDiagramLinkColor" value="-8454144" />
<option name="drawDecorations" value="false" />
<option name="hideFieldList" value="" />
<option name="showFieldList" value="" />
<option name="hideConstructorList" value="" />
<option name="showConstructorList" value="" />
<option name="hideMethodList" value="" />
<option name="showMethodList" value="" />
<option name="minimumFigureSize" value="0,0" />
</Classdiagram>
<Dependencydiagram>
<option name="diagramTitleFont" value="SansSerif,1,12" />
<option name="diagramFont" value="SansSerif,0,10" />
<option name="diagramBackgroundColor" value="-1" />
<option name="useAntialiasedConnectors" value="true" />
<option name="packageNameCompressionLevel" value="0" />
</Dependencydiagram>
<Packagediagram>
<option name="diagramTitleFont" value="SansSerif,0,12" />
<option name="diagramFont" value="SansSerif,0,10" />
<option name="packageBackgroundColor" value="-4144960" />
<option name="diagramBackgroundColor" value="-1" />
<option name="useAntialiasedConnectors" value="true" />
<option name="packageNameCompressionLevel" value="2" />
</Packagediagram>
</component>
</project>

View file

@ -15,6 +15,7 @@ Es gibt eine database.properties Datei, in dieser sind alle nötigen Verbindungs
Sonst könnt Ihr die ganze Suppe mit der Jar-File einfach in der cmd/PowerShell oder was auch immer Ihr benutzt mit `java -jar autovermietung.jar` ausführen.
### Aufsetzen der MySQL Datenbank
____
Zum erstellen der Datenbank wird diese Struktur verwendet.
```sql

View file

@ -40,6 +40,12 @@ public class Main {
Shop.autoAnzeigen(pkws, modelle, kunden);
Tastatur.liesString();
break;
// Auto miete beenden und Preis ausrechnen
case 3:
toDelete = Shop.mieteBeenden(pkws, modelle, kunden);
Database.deletePkw(pkws.get(toDelete));
pkws.remove(toDelete);
break;
// Auto löschen aus der Datenbank
case 9:
toDelete = Shop.autoEntfernen(pkws, modelle, kunden);

View file

@ -60,6 +60,7 @@ public class Shop {
menuText();
System.out.println("1.\tAutos vermieten");
System.out.println("2.\tAutos anzeigen");
System.out.println("3.\tMiete eines Autos beenden");
System.out.println("9.\tAuto entfernen");
menuEnde();
}
@ -211,6 +212,32 @@ public class Shop {
return Tastatur.liesInt() - 1;
}
public static int mieteBeenden(ArrayList<Pkw> autos, ArrayList<Modell> modelle, ArrayList<Kunde> kunden) {
clearScreen();
int autoNr;
int neuerTacho;
float kostenoP;
float kosten;
System.out.println("Liste der Autos:");
for (int i = 0; i < autos.size(); i++) {
System.out.print(i + 1 + ": ");
autos.get(i).getInformation();
System.out.print("\t" + modelle.get(autos.get(i).getMnr() - 1).getModellname());
System.out.println("\t" + kunden.get(autos.get(i).getKnr() - 1).getNachname());
}
System.out.print("Bitte die Nummer des Autos abgeben: ");
autoNr = Tastatur.liesInt() - 1;
System.out.print("Bitte den momentanen Tachostand angeben: ");
neuerTacho = Tastatur.liesInt();
kostenoP = (neuerTacho - autos.get(autoNr).getTachostand()) * modelle.get(autos.get(autoNr).getMnr() - 1).getKmpreis();
kosten = kostenoP + modelle.get(autos.get(autoNr).getMnr() - 1).getPauschale();
System.out.println("Der Preis beträgt: " + kosten);
return autoNr;
}
public static void programmBeendet() {
clearScreen();
System.out.println("Das Programm wurde durch den User beendet!");