erste Funktionen und Attribute
parent
58a383bac7
commit
e658f08152
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -1,4 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings" defaultProject="true" />
|
<component name="CommitMessageInspectionProfile">
|
||||||
|
<profile version="1.0">
|
||||||
|
<inspection_tool class="CommitFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="CommitNamingConvention" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -1,4 +1,58 @@
|
||||||
package de.deversmann;
|
package de.deversmann;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public class Auto {
|
public class Auto {
|
||||||
|
|
||||||
|
public Auto(String kennzeichen) {
|
||||||
|
this.kennzeichen = kennzeichen;
|
||||||
|
this.einfahrtZeit = new Date();
|
||||||
|
this.bezahlt = false;
|
||||||
|
this.ausfahrtZeit = new Date();
|
||||||
|
this.bezahlZeit = new Date();
|
||||||
|
}
|
||||||
|
private Calendar calendar = Calendar.getInstance();
|
||||||
|
|
||||||
|
private final String kennzeichen;
|
||||||
|
private Date einfahrtZeit;
|
||||||
|
private Date bezahlZeit;
|
||||||
|
private Date ausfahrtZeit;
|
||||||
|
private boolean bezahlt;
|
||||||
|
|
||||||
|
public String getKennzeichen() {
|
||||||
|
return kennzeichen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEinfahrtZeit() {
|
||||||
|
return einfahrtZeit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEinfahrtZeit() {
|
||||||
|
this.einfahrtZeit = calendar.getTime() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getBezahlZeit() {
|
||||||
|
return bezahlZeit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBezahlZeit(Date bezahlZeit) {
|
||||||
|
this.bezahlZeit = bezahlZeit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getAusfahrtZeit() {
|
||||||
|
return ausfahrtZeit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAusfahrtZeit(Date ausfahrtZeit) {
|
||||||
|
this.ausfahrtZeit = ausfahrtZeit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBezahlt() {
|
||||||
|
return bezahlt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBezahlt(boolean bezahlt) {
|
||||||
|
this.bezahlt = bezahlt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,12 @@ package de.deversmann;
|
||||||
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
|
|
||||||
// to see how IntelliJ IDEA suggests fixing it.
|
|
||||||
System.out.printf("Hello and welcome!");
|
|
||||||
|
|
||||||
for (int i = 1; i <= 5; i++) {
|
|
||||||
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
Parkhaus parkhaus = new Parkhaus();
|
||||||
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
Auto auto1 = new Auto("D-DL-2023");
|
||||||
System.out.println("i = " + i);
|
System.out.println(parkhaus.isGeöffnet());
|
||||||
}
|
System.out.println(auto1.getEinfahrtZeit());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,72 @@
|
||||||
package de.deversmann;
|
package de.deversmann;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
public class Parkhaus {
|
public class Parkhaus {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
private boolean geöffnet;
|
||||||
|
private int anzahlParkplätze;
|
||||||
|
|
||||||
|
public int getBelegteParkplätze() {
|
||||||
|
return belegteParkplätze;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBelegteParkplätze(int belegteParkplätze) {
|
||||||
|
this.belegteParkplätze = belegteParkplätze;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int belegteParkplätze;
|
||||||
|
private double kosten;
|
||||||
|
private double ticketPreis;
|
||||||
|
private double maxTagessatz;
|
||||||
|
private final int geöffnetAb = 6;
|
||||||
|
private final int geschlossenAb = 22;
|
||||||
|
|
||||||
|
public boolean isGeöffnet() {
|
||||||
|
|
||||||
|
if (calendar.getTime().getHours() >= geöffnetAb && calendar.getTime().getHours() < geschlossenAb ) {
|
||||||
|
geöffnet = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
geöffnet = false;
|
||||||
|
}
|
||||||
|
return geöffnet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGeöffnet(boolean geöffnet) {
|
||||||
|
this.geöffnet = geöffnet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAnzahlParkplätze() {
|
||||||
|
return anzahlParkplätze;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnzahlParkplätze(int anzahlParkplätze) {
|
||||||
|
this.anzahlParkplätze = anzahlParkplätze;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getKosten() {
|
||||||
|
return kosten;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKosten(double kosten) {
|
||||||
|
this.kosten = kosten;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getTicketPreis() {
|
||||||
|
return ticketPreis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicketPreis(double ticketPreis) {
|
||||||
|
this.ticketPreis = ticketPreis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getMaxTagessatz() {
|
||||||
|
return maxTagessatz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxTagessatz(double maxTagessatz) {
|
||||||
|
this.maxTagessatz = maxTagessatz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue