Compare commits
2 Commits
3d37013ac8
...
a4f0a1853e
Author | SHA1 | Date |
---|---|---|
Leon Maximilian Löhle | a4f0a1853e | |
Leon Maximilian Löhle | 058bdaa4e4 |
|
@ -1,10 +1,32 @@
|
|||
import java.util.Date;
|
||||
public class Parkhaus {
|
||||
|
||||
private double maxNachtPreis;
|
||||
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){
|
||||
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;}
|
||||
|
||||
|
@ -12,8 +34,29 @@ public class Parkhaus {
|
|||
this.preis = preis;
|
||||
}
|
||||
|
||||
public double berechneParkDauer (Auto auto){
|
||||
public double berechneParkKosten (Auto auto){
|
||||
int einFahrtStunde = auto.getEinfahrtZeit().getHours();
|
||||
int ausFahrtStunde = auto.getAusfahrtZeit().getHours();
|
||||
|
||||
long parkDauerMinuten = (auto.getBezahlZeit().getTime()-auto.getEinfahrtZeit().getTime());
|
||||
|
||||
if (einFahrtStunde >= 20 && ausFahrtStunde <= 06){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (parkDauerMinuten <= 15){
|
||||
return 0;
|
||||
}
|
||||
parkDauerMinuten -= 15;
|
||||
long parkDauerStunden = (parkDauerMinuten/60)+1;
|
||||
double kosten = parkDauerStunden*preis;
|
||||
|
||||
if (auto.getEAuto() == true){
|
||||
kosten*=0.8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue