From 3c0c934483539e68a68b2d5e21fa3c12db507927 Mon Sep 17 00:00:00 2001 From: Sage Burger Date: Tue, 22 Aug 2023 09:56:10 +0200 Subject: [PATCH] cleared the test code and transfeard data to Grundlagen --- bin/Grundlagen.class | Bin 2785 -> 3422 bytes bin/Testcode.class | Bin 3014 -> 367 bytes src/Grundlagen.java | 35 +++++++++++++++++++++--- src/Testcode.java | 63 +------------------------------------------ 4 files changed, 32 insertions(+), 66 deletions(-) diff --git a/bin/Grundlagen.class b/bin/Grundlagen.class index 3e6d71902e2ada8cc1870d0a927f8fa2b2681945..617f33bdf29fd4ab9fa6bbca0d42a1d4fb221889 100644 GIT binary patch delta 1204 zcmZ8gOK=ob6g{_@Pp9WUaY6>j@LZ4&j7jlv(8PeF5gkpm2mwt3WL{=E^T|wim`|9A z!k~g50-|a07t4k2a22US3rg9jRkE;LvhuTWW0ggfORFsJ3|XaL)w!o%zrN?(``-H_ z^y?Pw&VM(*12Bx$HErD1P%%O1ii?z))6Xed$yo{uIU~b@M!MgL;{<=6a|~1~xx&CWPntyy(`akLj2lTvg457zm4s0t z*m@Ivi6Cr9xv>*zLT7Ixk+6QDj;=XEcudwsC9B^rZ&nwlbCqmU_(AKq?d+7J>B}q< zf}t!cCv~D|g+CC;ktSk1-R?+UXT+V}J zx1MuGG+P`lJOC&?*UQdTYJ3HM@W>5xHsjIt_~Lq;hQThU7^d+9B>v(}~VVu6lQTmB*&d->n-}vO; z!?Z#;p|~)kG$N2nH#fq?_1?L^G03oAz@=1;L#c5`4 z_M1Wtb$HnINi4C5x9J@(GxKo;&)^kiey(FbH#3g_SJREN%z|9gHr~@bZ_hbvMhn|t zC4Q`PTF6?_I)`85vJ|||?FVm=9T&N{0j;XAkJ5xb5EZnJNED zRcLt8OU@2?3kh#>E@hK2F{{&>Va{gO6s%VNyzsWke79=Np7pBkvBQE;8DGjJr_)|0 z-H^$(HHbsbjM^QtXg2J2DVR_8l_Ns%dM1;~4bFM_d@66VY@$w!?}ZRC`&Ny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c#F>d0Uj9pYCfKZP?+Af43Vv$dgPl=B~TH?cu6=i|`xmXofXH~V)_$=IF z)0+!wVNp-HraSg;Ho!4c54`ZpK@dlAsH(F%E(fJ3i4d^``ZwHYOO2yle=S(m`R1iG zD|kv3;~=b?u-63cwTHd6x(RrN;qY`cJQD<~wd%yqIJeDg**IUX>JH1>gWjPkTM(1V z^XA-GPYm|r9UF}8p?NkC##IJOQsktNw2Pw~jZ0yJK|jR>b-CVXoPyOC2J37lVoaL( z5q48u*HKGv<6VK{#E2SwNjzRtRxVpmWZ*fl^S&o=u@K93iUgA-Rc8ZUYBnk_U{$Q} za(o`l{#KVuu1~{BgBq>l6w!o0s^I%Nob*%_>Bz$O*f)0EO{ZvEc%Oaae=lXmHm?T9 zSc_dSzg^_`cI9YM%99Gxo~Itc{&_>4YPH z45jxy!~sK(wy12;x2xjgaZhSQ|J6w6OD}>8F2zXU6UH3x*`p6NV(y7Yyl3Uo<4ul={;z8EGIr zX~>{se}MtVeu!5d;%gt_sFN^qVpAS4zFZ~#&qQk5(l1r`$A8_0KR8JPnA{17&z(M_ z>g%BTiIXy_R0q`uPQOw0cTlZ314cE_L3Py`G^)W4sqzm8c&N8{2(}u zXT&9(6<7G$zm0REi08x_-|_F^1#uVS;v-CmPxxMbfD7UgU&3GDqWBXoiND}-Bbk5N zOjx{*TeLqbeuFn~o9Ubrzrve%i`8*P{1V?F*F}U+@HV+_z9jEsfm{!6iXYLJw^$%b z{1A)eOdT$vh!SJ*p?DjbTmpB+>sTU}#69sEmdW+uzL-XtTnZnHNx0=O3=8^6Vng^Gn?(fC=I>i7=~Cb$2cq5VE_b|FBO^dP-hqo3=IvECTJ T)fm5x?@*tl?z{LtegNk`)l&2t diff --git a/src/Grundlagen.java b/src/Grundlagen.java index 0eb3e88..d6e5cbc 100644 --- a/src/Grundlagen.java +++ b/src/Grundlagen.java @@ -1,3 +1,5 @@ +import java.util.Random; + import javax.swing.JOptionPane; public class Grundlagen { @@ -20,16 +22,16 @@ public class Grundlagen { if (x > 101) { System.out.println("Der Wert ist grösser als 101"); } else { - System.out.println("Der Wert ist kleiner als 101"); + System.out.println("Der Wert ist kleiner als 101"); } // Iteration int anzahlDurchgaenge = 1; - while(anzahlDurchgaenge <= 5) { + while (anzahlDurchgaenge <= 5) { System.out.println("Durchgang nr. " + anzahlDurchgaenge); anzahlDurchgaenge = anzahlDurchgaenge + 1; } - + // Lückentexte / kombination aus variablen, print und if/else // Popups mit User Input @@ -43,7 +45,7 @@ public class Grundlagen { String h = JOptionPane.showInputDialog("Please enter an object"); // Error message - + if (a == null || a.trim().isEmpty()) { System.out.println("Missing word(s) or canceled."); } else if (b == null || b.trim().isEmpty()) { @@ -68,5 +70,30 @@ public class Grundlagen { System.out.println(c + " as (the) " + d + " They're hair as " + e + " as (the) " + f + "."); System.out.println("It was a " + g + " day, after a long journey they finally found their " + h); } + + // Print text + + System.out.println("A code request you have made,"); + System.out.println("Fear not, for I am here to aid."); + System.out.println("In Java, a language so grand,"); + System.out.println("I'll lend you a helping hand."); + + // Creating a Random object + Random random = new Random(); + + // Define the range for xx, yy and zz + int minRange = -10000; + int maxRange = 10000; + + // Generate random values for xx, zz and yy within the specified range + int xx = random.nextInt(maxRange - minRange + 1) + minRange; + int yy = random.nextInt(maxRange - minRange + 1) + minRange; + int zz = random.nextInt(maxRange - minRange + 1) + minRange; + + int sum = xx + yy + zz; + + System.out.println("The sum of " + xx + ", " + yy + " and " + zz + " is: " + sum); + + System.out.println("May the code be with you!"); } } \ No newline at end of file diff --git a/src/Testcode.java b/src/Testcode.java index 59c83b5..6ae107d 100644 --- a/src/Testcode.java +++ b/src/Testcode.java @@ -1,67 +1,6 @@ -import java.util.Random; - -import javax.swing.JOptionPane; - public class Testcode { public static void main(String[] args) { - - System.out.println("A code request you have made,"); - System.out.println("Fear not, for I am here to aid."); - System.out.println("In Java, a language so grand,"); - System.out.println("I'll lend you a helping hand."); - - // Creating a Random object - Random random = new Random(); - // Define the range for x, y and z - int minRange = -10000; - int maxRange = 10000; - - // Generate random values for x and y within the specified range - int x = random.nextInt(maxRange - minRange + 1) + minRange; - int y = random.nextInt(maxRange - minRange + 1) + minRange; - int z = random.nextInt(maxRange - minRange + 1) + minRange; - - int sum = x + y + z; - - System.out.println("The sum of " + x + ", " + y + " and " + z + " is: " + sum); - - System.out.println("May the code be with you!"); - - // Testing Inputs with a gap text - - // Display a popup dialog and get user input - String a = JOptionPane.showInputDialog("Please enter a verb (-ing):"); - String b = JOptionPane.showInputDialog("Please enter a location:"); - String c = JOptionPane.showInputDialog("Please enter a color:"); - String d = JOptionPane.showInputDialog("Please enter an object in that color:"); - String e = JOptionPane.showInputDialog("Please enter a diffrent color:"); - String f = JOptionPane.showInputDialog("Please enter an object in that color:"); - String g = JOptionPane.showInputDialog("Please enter an adjective:"); - String h = JOptionPane.showInputDialog("Please enter an object"); - - if ((a == null || a.trim().isEmpty()) && (b == null || b.trim().isEmpty())) { - System.out.println("Missing word(s) or canceled."); - } else if (a == null || a.trim().isEmpty()) { - System.out.println("Missing word(s) or canceled."); - } else if (b == null || b.trim().isEmpty()) { - System.out.println("Missing word(s) or canceled."); - } else if (c == null || c.trim().isEmpty()) { - System.out.println("Missing word(s) or canceled."); - } else if (d == null || d.trim().isEmpty()) { - System.out.println("Missing word(s) or canceled."); - } else if (e == null || e.trim().isEmpty()) { - System.out.println("Missing word(s) or canceled."); - } else if (f == null || f.trim().isEmpty()) { - System.out.println("Missing word(s) or canceled."); - } else if (g == null || g.trim().isEmpty()) { - System.out.println("Missing word(s) or canceled."); - } else if (h == null || h.trim().isEmpty()) { - System.out.println("Missing word(s) or canceled."); - } else { - System.out.println("They where " + a + " throw a " + b + ". They're eyes where "); - System.out.println(c + " as the " + d + " They're hair as " + e + " as " + f + "."); - System.out.println("It was a " + g + " day, after a long journey they finally found their " + h); - } + } }