diff --git a/InputOutputException/src/.DS_Store b/InputOutputException/src/.DS_Store new file mode 100644 index 0000000..c91445d Binary files /dev/null and b/InputOutputException/src/.DS_Store differ diff --git a/InputOutputException/src/.classpath b/InputOutputException/src/.classpath new file mode 100644 index 0000000..f029363 --- /dev/null +++ b/InputOutputException/src/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/InputOutputException/src/.project b/InputOutputException/src/.project new file mode 100644 index 0000000..8f9aea7 --- /dev/null +++ b/InputOutputException/src/.project @@ -0,0 +1,17 @@ + + + Indexverwaltung + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/InputOutputException/src/.settings/org.eclipse.core.resources.prefs b/InputOutputException/src/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/InputOutputException/src/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/InputOutputException/src/.settings/org.eclipse.jdt.core.prefs b/InputOutputException/src/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..062ed70 --- /dev/null +++ b/InputOutputException/src/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=19 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=19 +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=19 diff --git a/InputOutputException/src/inputOutput/Datei.java b/InputOutputException/src/inputOutput/Datei.java new file mode 100644 index 0000000..ef64268 --- /dev/null +++ b/InputOutputException/src/inputOutput/Datei.java @@ -0,0 +1,5 @@ +package inputOutput; + +public class Datei { + +} diff --git a/InputOutputException/src/inputOutput/DemoConsole.java b/InputOutputException/src/inputOutput/DemoConsole.java new file mode 100644 index 0000000..727361b --- /dev/null +++ b/InputOutputException/src/inputOutput/DemoConsole.java @@ -0,0 +1,19 @@ +package inputOutput; +public class DemoConsole { + public static void main(String[] args) throws Exception { + System.out.println("Text eingeben: "); + String text = Console.readString(); + System.out.println("Gelesener Text: " + text); + + System.out.println("Text eingeben: "); + char [] ca = Console.readCharArray(); + System.out.println("Gelesenes char-Feld: "); + for(char celement: ca) + System.out.print(celement); + System.out.println(); + + System.out.println("Boolean eingeben: "); + boolean b = Console.readBoolean(); + System.out.println("Gelesener Wert: " + b); + } +} diff --git a/InputOutputException/src/inputOutput/src/Index.java b/InputOutputException/src/inputOutput/Index.java similarity index 98% rename from InputOutputException/src/inputOutput/src/Index.java rename to InputOutputException/src/inputOutput/Index.java index b7c29a5..7f14fd9 100644 --- a/InputOutputException/src/inputOutput/src/Index.java +++ b/InputOutputException/src/inputOutput/Index.java @@ -1,5 +1,4 @@ -package inputOutput.src; - +package inputOutput; import java.util.*; import java.io.*; diff --git a/InputOutputException/src/inputOutput/src/IndexUI.java b/InputOutputException/src/inputOutput/IndexUI.java similarity index 81% rename from InputOutputException/src/inputOutput/src/IndexUI.java rename to InputOutputException/src/inputOutput/IndexUI.java index b24d988..e825a27 100644 --- a/InputOutputException/src/inputOutput/src/IndexUI.java +++ b/InputOutputException/src/inputOutput/IndexUI.java @@ -1,5 +1,4 @@ -package inputOutput.src; - +package inputOutput; public class IndexUI { diff --git a/InputOutputException/src/inputOutput/ZaehlerUI.java b/InputOutputException/src/inputOutput/ZaehlerUI.java new file mode 100644 index 0000000..6d3ea00 --- /dev/null +++ b/InputOutputException/src/inputOutput/ZaehlerUI.java @@ -0,0 +1,50 @@ +package inputOutput; +public class ZaehlerUI { + public static void main(String[] args) throws Exception { + Zaehler einZaehler, klonZaehler = null; + + Verbraucher einVerbraucher = new Verbraucher("Schulz"); + einZaehler = new Zaehler("Elektro", einVerbraucher, 123); + + try + { + klonZaehler = einZaehler.clone(); + } + catch(CloneNotSupportedException e) + { + System.out.println("Fehler"); + } + + System.out.println("Zählerstand =" + einZaehler.getZaehlerstand() + + " gehört zu Verbraucher " + einZaehler.getMeinVerbraucher().getName()); + + System.out.println("Geklonter Zähler Zählerstand = " + klonZaehler.getZaehlerstand() + + " gehört zu Verbraucher " + klonZaehler.getMeinVerbraucher().getName()); + + if(einZaehler.getMeinVerbraucher() == klonZaehler.getMeinVerbraucher()) + System.out.println("Verbraucher identisch"); + else + System.out.println("Verbraucher nicht identisch"); + + Unterzaehler nochEinZaehler = new Unterzaehler("Gas", einVerbraucher, 500); + + System.out.println("Zählerstand = " + nochEinZaehler.getZaehlerstand() + + " Unterzählerstand: " + nochEinZaehler.getUnterzaehlerstand() + + " gehört zu Verbraucher " + nochEinZaehler.getMeinVerbraucher().getName()); + + Unterzaehler klonUnterzaehler = null; + + try + { + klonUnterzaehler = nochEinZaehler.clone(); + } + catch(CloneNotSupportedException e) + { + System.out.println("Fehler"); + } + + System.out.println("Geklonter Unterzähler: Zählerstand = " + klonUnterzaehler.getZaehlerstand() + + " Unterzählerstand: " + klonUnterzaehler.getUnterzaehlerstand() + + " gehört zu Verbraucher " + klonUnterzaehler.getMeinVerbraucher().getName()); + } +} diff --git a/InputOutputException/src/inputOutput/src/Datei.java b/InputOutputException/src/inputOutput/src/Datei.java deleted file mode 100644 index beb9ff5..0000000 --- a/InputOutputException/src/inputOutput/src/Datei.java +++ /dev/null @@ -1,6 +0,0 @@ -package inputOutput.src; - - -public class Datei { - -}