This commit is contained in:
Luca Conte 2023-03-24 14:19:23 +01:00
parent 3c630a23a4
commit ca71ca11cc
7 changed files with 84 additions and 0 deletions

BIN
u04.zip Normal file

Binary file not shown.

10
u04/.classpath Normal file
View File

@ -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>

1
u04/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/bin/

17
u04/.project Normal file
View File

@ -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>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -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

40
u04/src/Datum.java Normal file
View File

@ -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++;
}
}
}
}