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

@ -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!");