u04
This commit is contained in:
parent
3c630a23a4
commit
ca71ca11cc
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -0,0 +1 @@
|
|||
/bin/
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>u04</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,2 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
|
@ -0,0 +1,14 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
|
@ -0,0 +1,40 @@
|
|||
/** Klasse zum Abspeichern, Ausgeben und Modifizieren eines Datums */
|
||||
public class Datum {
|
||||
public int tag;
|
||||
public int monat;
|
||||
public int jahr;
|
||||
|
||||
/** gibt zurück ob es sich bei dem Jahr des Datums um ein Schaltjahr handelt */
|
||||
public boolean istSchaltjahr() {
|
||||
return jahr % 4 == 0 && (jahr % 100 != 0 || jahr % 400 == 0);
|
||||
}
|
||||
|
||||
/** gibt das Datum in deutscher Schreibweise aus (tt.mm.jjjj) */
|
||||
public String getDeutscheSchreibung() {
|
||||
return String.format("%02d.%02d.%04d", tag, monat, jahr);
|
||||
}
|
||||
|
||||
/** gibt das Datum in amerikanischer Schreibweise aus (mm/tt/jjjj) */
|
||||
public String getAmerikanischeSchreibung() {
|
||||
return String.format("%02d/%02d/%04d", monat, tag, jahr);
|
||||
}
|
||||
|
||||
/** setzt das Datum auf das Datum von Morgen */
|
||||
public void setMorgen() {
|
||||
tag++;
|
||||
|
||||
// Tage im Aktuellen Monat ermitteln
|
||||
int tageImMonat = monat == 2 ? istSchaltjahr() ? 29 : 28 :
|
||||
monat < 8 ? monat % 2 == 0 ? 30 : 31 : monat % 2 == 0 ? 31 : 30;
|
||||
|
||||
if (tag > tageImMonat) {
|
||||
monat++;
|
||||
tag = 1;
|
||||
if (monat > 12) {
|
||||
monat = 1;
|
||||
jahr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue