From 8a326f55b157bca476ababf190d917463d52b0e5 Mon Sep 17 00:00:00 2001 From: lorenzo Date: Mon, 8 Apr 2024 11:50:30 +0200 Subject: [PATCH] neu neu --- InputOutputException/src/.DS_Store | Bin 0 -> 6148 bytes InputOutputException/src/.classpath | 10 ++++ InputOutputException/src/.project | 17 ++++++ .../org.eclipse.core.resources.prefs | 2 + .../src/.settings/org.eclipse.jdt.core.prefs | 14 +++++ .../src/inputOutput/Datei.java | 5 ++ .../src/inputOutput/DemoConsole.java | 19 +++++++ .../src/inputOutput/{src => }/Index.java | 3 +- .../src/inputOutput/{src => }/IndexUI.java | 3 +- .../src/inputOutput/ZaehlerUI.java | 50 ++++++++++++++++++ .../src/inputOutput/src/Datei.java | 6 --- 11 files changed, 119 insertions(+), 10 deletions(-) create mode 100644 InputOutputException/src/.DS_Store create mode 100644 InputOutputException/src/.classpath create mode 100644 InputOutputException/src/.project create mode 100644 InputOutputException/src/.settings/org.eclipse.core.resources.prefs create mode 100644 InputOutputException/src/.settings/org.eclipse.jdt.core.prefs create mode 100644 InputOutputException/src/inputOutput/Datei.java create mode 100644 InputOutputException/src/inputOutput/DemoConsole.java rename InputOutputException/src/inputOutput/{src => }/Index.java (98%) rename InputOutputException/src/inputOutput/{src => }/IndexUI.java (81%) create mode 100644 InputOutputException/src/inputOutput/ZaehlerUI.java delete mode 100644 InputOutputException/src/inputOutput/src/Datei.java diff --git a/InputOutputException/src/.DS_Store b/InputOutputException/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c91445dcf97ebc5774a243bb5a6de77f6e7aa8b7 GIT binary patch literal 6148 zcmeHK%}T>S5Z-O8O(;SSiXH=Ai#AZS;3d?0@M=U4Dm7_}24l7~tvQrJuKF?_eG^|t zXLhGTsoq4e%)sooJ3pK5w`F%n2q8O@$Q7b4gs?ynOExs$2>MZ%q(qhqpu{;;KTK2z zBb<)qKQMrMR~DHViT-J_uz#=M+56C<7eY~Co(*Z2-@;)MXX9q`U6#s~we_l1wQAOl zf3I?X9E>MfCm3Df=v=8JocDw9A|B+u`sT4p$3dJ9Mmiym1`u+68K;rTJ8F_fna=f% z!?G>ASKppaUAN)5t;1QvnYLR84X4$1XEWQ{+TA}o>pdiosd_fNOZZD_*&v+53v_5P zQPxjF_;KhW)000+6P4b9Wj+CVS(pK4fEidN2IzdVYOAy;UJEn84EzcMcs@9wh#p~K zP#+!8=n?=BpOIRiuOI(_4jKSG!ona}K%_|pG^vtG3`w + + + + + + + + + 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 { - -}