Anpassung der Parkhaus Klasse durch einbrinung der Maximal Preise und durch einsetzung der maximalen Parkplätze
parent
3d37013ac8
commit
058bdaa4e4
|
@ -1,10 +1,32 @@
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
public class Parkhaus {
|
public class Parkhaus {
|
||||||
|
private double maxNachtPreis;
|
||||||
private double preis;
|
private double preis;
|
||||||
|
private double maxTagesPreis;
|
||||||
|
private int maxParkPlatz;
|
||||||
|
private Auto[] parkendeAutos;
|
||||||
|
private int anzahlParkendeAutos;
|
||||||
|
|
||||||
|
public double getMaxNachtPreis() {
|
||||||
|
return maxNachtPreis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getMaxTagesPreis() {
|
||||||
|
return maxTagesPreis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxParkPlatz() {
|
||||||
|
return maxParkPlatz;
|
||||||
|
}
|
||||||
|
|
||||||
public Parkhaus(double preis){
|
public Parkhaus(double preis){
|
||||||
this.preis = preis;}
|
this.preis = 1.0;
|
||||||
|
this.maxNachtPreis = 5;
|
||||||
|
this.maxTagesPreis = 15;
|
||||||
|
this.maxParkPlatz = 100;
|
||||||
|
this.parkendeAutos = new Auto[maxParkPlatz];
|
||||||
|
this.anzahlParkendeAutos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
public double getPreis() {return preis;}
|
public double getPreis() {return preis;}
|
||||||
|
|
||||||
|
@ -12,8 +34,15 @@ public class Parkhaus {
|
||||||
this.preis = preis;
|
this.preis = preis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double berechneParkDauer (Auto auto){
|
public double berechneParkKosten (Auto auto){
|
||||||
|
long parkDauerMinuten = (auto.getBezahlZeit().getTime()-auto.getEinfahrtZeit().getTime());
|
||||||
|
|
||||||
|
if (parkDauerMinuten <= 15){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
parkDauerMinuten -= 15;
|
||||||
|
long parkDauerStunden = (parkDauerMinuten/60)+1;
|
||||||
|
double kosten = parkDauerStunden*preis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue