From 694d43f8aacbb428c12edf43e3ea6480aea12c1c Mon Sep 17 00:00:00 2001 From: Mina Botros <36329091+Mina1998@users.noreply.github.com> Date: Thu, 27 Feb 2020 09:43:04 +0200 Subject: [PATCH 01/78] First Version of the task --- src/.classpath | 6 ++++++ src/.project | 17 +++++++++++++++++ src/CircleVolume.class | Bin 0 -> 545 bytes src/CircleVolume.java | 10 ++++++++++ src/ISubscriber.class | Bin 0 -> 154 bytes src/Main.class | Bin 0 -> 1171 bytes src/Main.java | 1 + src/ReallySimpleSubscriber.class | Bin 0 -> 800 bytes src/SimpleSubscriber.class | Bin 0 -> 775 bytes src/Topic.class | Bin 0 -> 1189 bytes 10 files changed, 34 insertions(+) create mode 100644 src/.classpath create mode 100644 src/.project create mode 100644 src/CircleVolume.class create mode 100644 src/CircleVolume.java create mode 100644 src/ISubscriber.class create mode 100644 src/Main.class create mode 100644 src/ReallySimpleSubscriber.class create mode 100644 src/SimpleSubscriber.class create mode 100644 src/Topic.class diff --git a/src/.classpath b/src/.classpath new file mode 100644 index 0000000..3f3893a --- /dev/null +++ b/src/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/.project b/src/.project new file mode 100644 index 0000000..0c67e86 --- /dev/null +++ b/src/.project @@ -0,0 +1,17 @@ + + + Software Assignment Team 15 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/src/CircleVolume.class b/src/CircleVolume.class new file mode 100644 index 0000000000000000000000000000000000000000..bf4b907a0673538fbb06a3f522199df2f72b4bcc GIT binary patch literal 545 zcmZXR%TB^j5QhILmqMu^Meu&#fD3VHf-x~BCMHBpFznlU#6x-^r8VKPbfJk0AHat) z&M727Ty&;$&iwy;)BgN^eFHehu?~%3Udzb!L_hQrU+BmZR)_Yh-S+HY(7tzu!i{z0 z38mX!;*8x$IwB(EFJvI&OG2jE>Jzfp;gc|sLCJ)U0-@5Cfw)V2Zho{KPY|qb=-OW2 zj-;w*huQc=jtS-NB1DG~f-siPlf{YkW_Qljiz68fI<0;YHPm&iEm8L-<5>768dzt* zFo_BEsaS^X2UfnM=W=l*h7_|kCf002ss&yl&AF{h+y=> zByz=#R6AD}*E&_+I0Pf{ljC2YapteZvB*`MGjYzHe8PB3uT75m^iabJznjwrlu_Y| tcSeeH^e2F`HsK`U8;mZzcc$ literal 0 HcmV?d00001 diff --git a/src/CircleVolume.java b/src/CircleVolume.java new file mode 100644 index 0000000..f8743dc --- /dev/null +++ b/src/CircleVolume.java @@ -0,0 +1,10 @@ + +public class CircleVolume implements ISubscriber { + + @Override + public void notifySubscriber(String input) { + // TODO Auto-generated method stub + System.out.println("0"); + } + +} diff --git a/src/ISubscriber.class b/src/ISubscriber.class new file mode 100644 index 0000000000000000000000000000000000000000..a83512f2b788a72f2112d3a4bd5ec50f3e87837f GIT binary patch literal 154 zcmX^0Z`VEs1_lcTPId++Mh0%r;L@bx+K!ujCDk2C)P!W`*#l$5|Do@*G1B=^j({72p`$v58 zSxg|Yk$3$y{sQ&fh42w*(tGDl&&-@TGyVPd#|eOESl18|Q1hnaX;1~)_so4WdZSdgYEH?n)dkwNa_h#qBP$SHv|Pt?{3QV;l`b&ZN@d&D(89<|NDZyb zZaC$tYhT32p(CNA9Z`YEVvt5dhd|GJ+jQN7>+mEJ8oCAa6{lvocA?@n%61%GNW>s; zOGg+Hfke*n?2Sg5lsCipkYWLyjiI_Rvd#!$m4;IhZqrPHMh4fT4T4VD^khelt41b+VCAWV_2r= z*|iwPFri`miu%Su-M7m+CNU)tl8m}f`8bu#x>s%Zq-2}rY#gI_Bo%zj_ER@P(gg{6 zqGJY6*`H^B;#9j*>FfQ;Zsv5Z#XP&&cIs8rw{}%2iO zfmqq}cLTKqv|M0NVuc&U0$0>wlXZ(}PDx#shXG+nb}XlOZ6wTN_@?zSZ&rh;YRGDG z1>#1fQM2qdM@~N`XFDZhF~l`dxcWrMU7@8Q3XNaF`1(Mv{ES3?B3@LQ(2K`tGm2^x zNm`voG2BEKtsdh$dcP4FLLblDK`xbNn8S$htzj4{HzP`0qGU}j`dOU}Z$V#p>=^wQ zX(EAB2}1N!0PbLbz!>i09zBxeFOrtjmzx+QmEqhWdW#F;lUY?+`il0x@W6C_eBucA zKPzIOTmACyPZOiXL!^(9$OSy@&I*bkEzs7Mqo=;wcOkarqw+?WLB$$AON zfYMB$&N3E|B|eHdEaEvy_0zwEWp+8k$QO7?Yn~KeVTBc56WfE(KOPYcs~Xb_pk41 literal 0 HcmV?d00001 diff --git a/src/Main.java b/src/Main.java index 9b8c2b0..9fd9910 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,6 +4,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + new CircleVolume(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); diff --git a/src/ReallySimpleSubscriber.class b/src/ReallySimpleSubscriber.class new file mode 100644 index 0000000000000000000000000000000000000000..0764dc0a4c19bfb50394ba6960b65a0daf977c71 GIT binary patch literal 800 zcmZuv+iuf95IvhFaq1dM(&hr?vZY*-w$!gkL45!TQ7NK`RFQbx#M^eO^+om?l+S{P zR04?);G+;@J0g_i!LvK-IcLwD*!TD}Plw8nv>c}6WD={fj4hNI z?p%q_!qp!q6G4meVIOL1@(Z^xwOi-N8cP(8MaZ==VnJ*h167 z_6_~RX=0@BpoKO`4O7F=EWj#sKM>LoUJAc&;Vwh_f7;in(w>ZK*kL$+C$$a_`3V<3 zCk(mA1y6DVdGgmmE&{Kp$%QNF@h{3;avL2y$jqr{yGITX{v7w_q3KH+>a)b0u2oQBYi`%%zplTG_vb{WbsXP^{*MCETLDQxxDf zHYuZlqE0abpQ223K>HgSKhXKqxOa{F2QxgJ;qeU57Ib!AR;9sPIc2MW%_)fh2RI~B Ka-Qf)IQj#I488~e literal 0 HcmV?d00001 diff --git a/src/SimpleSubscriber.class b/src/SimpleSubscriber.class new file mode 100644 index 0000000000000000000000000000000000000000..0525bade573c3404a9af6708c16877c257a96388 GIT binary patch literal 775 zcmZuv%Wl&^6g`tBaq1e{q)k)a?hBH()Ju?pSb&766j3BskyuXRX*-oYw(K#ep9PCl z0*MdcqY!uOh|q+E@63H2pL_27`u+VUfS2$rR2bHL86~0c^HDZVW?kuEbbds57jb%*q(*ucVUtHN#T3H)N>3jRRq02`dgPG#FL~Qi%_FM3`rM6bgpc zARhB@$Wv+jX|Spr|?Xes8#pb+j#P++yxuXIexK zHqjxHajqHKWwVUEkJPEDU+}1J;T}V09`;Qx!$71BJYab7UW8$MPbHU6ynN1cvskeJfM7 zoJ!_JanCM!0+B|u*eJQOXuAy-i!k!NN-i3&rB5r0#9mXJB&U=4TKQZF(@$7p;&ia>p<~@5koWtfw+Mn`UM7a(y_Oj z?DptuI&(%s+wP3kY-P^%{w<{@I&-p!)KWdfB9Z77+?2(u%L~sdLbX*pQb#y2R z2Cib9x(OgKYPLGd>vt7%pxdO=^s?Byh8^HoHIur*Igh9SbFlMyg zU=&H-1jcZojrWusnyN^D#qit_E^2t$!3z7iD4AnEPO??o#! Date: Thu, 27 Feb 2020 17:56:36 +0200 Subject: [PATCH 02/78] Update Main.java --- src/CircleCircumference.java | 47 +++++++++++++++++++++++++++++++++ src/ISubscriber.java | 2 ++ src/Main.java | 3 +++ src/ReallySimpleSubscriber.java | 2 ++ src/SimpleSubscriber.java | 2 ++ src/Topic.java | 2 ++ 6 files changed, 58 insertions(+) create mode 100644 src/CircleCircumference.java diff --git a/src/CircleCircumference.java b/src/CircleCircumference.java new file mode 100644 index 0000000..fdc21ef --- /dev/null +++ b/src/CircleCircumference.java @@ -0,0 +1,47 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package SW2_git_assignment_CircleCircumference; + +import java.util.Scanner; + +/** + * + * @author lenovo + */ +public class CircleCircumference implements ISubscriber { + + @Override + public void notifySubscriber(String input) { + // TODO Auto-generated method stub + System.out.println("Hello, I am CircleCircumference subscriber and I am notified with " + input); + display(input); + } + + void display(String input){ // accept input and check if valid or not then call get_CircleCircumference and display the result. + double radius=0; + try{ //check if the input can converted to double or not .. + radius=Double.valueOf(input); // convert input String to double. + }catch (NumberFormatException e) { + System.out.println(" invalid input "); + e.getMessage(); + return; + } + if (radius<0) {System.out.println(" Sorry,You enterd invalid radius. "); return; } //its invalid if the input radius < 0. + double circumference = get_CircleCircumference(radius); + System.out.println(" Circumference of a Circle = " + circumference); + } + + double get_CircleCircumference(double radius){ //calc CircleCircumference. + double circumference; + circumference = 2 * Math.PI * radius; + return circumference; + } + + + + + +} diff --git a/src/ISubscriber.java b/src/ISubscriber.java index d3a605c..debdad8 100644 --- a/src/ISubscriber.java +++ b/src/ISubscriber.java @@ -1,3 +1,5 @@ +package SW2_git_assignment_CircleCircumference; + public interface ISubscriber { public abstract void notifySubscriber(String input); diff --git a/src/Main.java b/src/Main.java index 9b8c2b0..26d9f57 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,9 +1,12 @@ +package SW2_git_assignment_CircleCircumference; + import java.util.Scanner; public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + new CircleCircumference() }; public static void main(String[] args) { Topic mathTopic = new Topic(); diff --git a/src/ReallySimpleSubscriber.java b/src/ReallySimpleSubscriber.java index fb1114a..f4ff81a 100644 --- a/src/ReallySimpleSubscriber.java +++ b/src/ReallySimpleSubscriber.java @@ -1,3 +1,5 @@ +package SW2_git_assignment_CircleCircumference; + public class ReallySimpleSubscriber implements ISubscriber { @Override diff --git a/src/SimpleSubscriber.java b/src/SimpleSubscriber.java index 5b0e4aa..45fb4ff 100644 --- a/src/SimpleSubscriber.java +++ b/src/SimpleSubscriber.java @@ -1,3 +1,5 @@ +package SW2_git_assignment_CircleCircumference; + public class SimpleSubscriber implements ISubscriber { diff --git a/src/Topic.java b/src/Topic.java index 8fa2e2e..3a3a2de 100644 --- a/src/Topic.java +++ b/src/Topic.java @@ -1,3 +1,5 @@ +package SW2_git_assignment_CircleCircumference; + import java.util.ArrayList; import java.util.List; From 62e65080338f8e49150518d15d50938425e2c169 Mon Sep 17 00:00:00 2001 From: Fatima <44647655+fatima196@users.noreply.github.com> Date: Fri, 28 Feb 2020 10:25:02 +0200 Subject: [PATCH 03/78] Update Main.java --- src/Main.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Main.java b/src/Main.java index 26d9f57..7e17fd9 100644 --- a/src/Main.java +++ b/src/Main.java @@ -6,6 +6,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + new CircleCircumference() }; public static void main(String[] args) { From efa35d1692d48e9a9e747a6c1a870c77186393a6 Mon Sep 17 00:00:00 2001 From: Fatima <44647655+fatima196@users.noreply.github.com> Date: Fri, 28 Feb 2020 14:12:00 +0200 Subject: [PATCH 04/78] Update Main.java --- src/Main.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Main.java b/src/Main.java index 26d9f57..2c5b083 100644 --- a/src/Main.java +++ b/src/Main.java @@ -6,6 +6,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + new CircleCircumference() }; public static void main(String[] args) { From b6e468ef7399156a8cef5821de8ce74798d7e1d8 Mon Sep 17 00:00:00 2001 From: Fatima <44647655+fatima196@users.noreply.github.com> Date: Sat, 29 Feb 2020 01:27:45 +0200 Subject: [PATCH 05/78] Update CircleCircumference.java --- src/CircleCircumference.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CircleCircumference.java b/src/CircleCircumference.java index fdc21ef..eced8fa 100644 --- a/src/CircleCircumference.java +++ b/src/CircleCircumference.java @@ -26,7 +26,7 @@ void display(String input){ // accept input and check if valid or not then call radius=Double.valueOf(input); // convert input String to double. }catch (NumberFormatException e) { System.out.println(" invalid input "); - e.getMessage(); + System.out.println(" "+ e.getMessage()); return; } if (radius<0) {System.out.println(" Sorry,You enterd invalid radius. "); return; } //its invalid if the input radius < 0. From 87793dfddd56eb9e8d4d5a022927fedf40208b5b Mon Sep 17 00:00:00 2001 From: Megadardery Date: Sat, 29 Feb 2020 09:43:49 +0200 Subject: [PATCH 06/78] Initial code for Sphere Circumference --- src/Main.java | 1 + src/SphereCircumference.java | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/SphereCircumference.java diff --git a/src/Main.java b/src/Main.java index 9b8c2b0..d6af4fd 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,6 +4,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + new SphereCircumference(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); diff --git a/src/SphereCircumference.java b/src/SphereCircumference.java new file mode 100644 index 0000000..1c2c086 --- /dev/null +++ b/src/SphereCircumference.java @@ -0,0 +1,25 @@ +public class SphereCircumference implements ISubscriber { + @Override + public void notifySubscriber(String input) { + System.out.println("Hello, I am Sphere Circumference and I am notified with " + input); + + double radius; + try { + radius = Double.parseDouble(input); + if (radius < 0) { + System.out.println("Radius is negative."); + return; + } + + } catch (NumberFormatException ignored) { + System.out.println("Radius is not a number."); + return; + } + + System.out.println("Radius is " + radius + ", Sphere Circumference is: " + doCalculation(radius)); + } + + public double doCalculation(double input) { + return 2 * Math.PI * input; + } +} From 5d9d29f9ff33cdc0f3ed19bd4961ac8db5fee225 Mon Sep 17 00:00:00 2001 From: Fatima <44647655+fatima196@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:38:10 +0200 Subject: [PATCH 07/78] update 1 in class CircleCircumference --- src/CircleCircumference.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/CircleCircumference.java b/src/CircleCircumference.java index eced8fa..3b088d3 100644 --- a/src/CircleCircumference.java +++ b/src/CircleCircumference.java @@ -1,16 +1,5 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package SW2_git_assignment_CircleCircumference; - import java.util.Scanner; -/** - * - * @author lenovo - */ public class CircleCircumference implements ISubscriber { @Override From 86a428e1c676b7da673af204835d56a11ac1f3be Mon Sep 17 00:00:00 2001 From: Fatima <44647655+fatima196@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:39:02 +0200 Subject: [PATCH 08/78] Update ISubscriber.java --- src/ISubscriber.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ISubscriber.java b/src/ISubscriber.java index debdad8..d3a605c 100644 --- a/src/ISubscriber.java +++ b/src/ISubscriber.java @@ -1,5 +1,3 @@ -package SW2_git_assignment_CircleCircumference; - public interface ISubscriber { public abstract void notifySubscriber(String input); From ebaba07e68cc807ed54cab28c132c7144e449e1b Mon Sep 17 00:00:00 2001 From: Fatima <44647655+fatima196@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:39:30 +0200 Subject: [PATCH 09/78] Update Main.java --- src/Main.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Main.java b/src/Main.java index 26d9f57..6f5a777 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,5 +1,3 @@ -package SW2_git_assignment_CircleCircumference; - import java.util.Scanner; public class Main { From 8278cf7d82a35ec9736df41512e65ccca710f4b1 Mon Sep 17 00:00:00 2001 From: Fatima <44647655+fatima196@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:39:53 +0200 Subject: [PATCH 10/78] Update ReallySimpleSubscriber.java --- src/ReallySimpleSubscriber.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ReallySimpleSubscriber.java b/src/ReallySimpleSubscriber.java index f4ff81a..fb1114a 100644 --- a/src/ReallySimpleSubscriber.java +++ b/src/ReallySimpleSubscriber.java @@ -1,5 +1,3 @@ -package SW2_git_assignment_CircleCircumference; - public class ReallySimpleSubscriber implements ISubscriber { @Override From 0800e1f56f2aaf9ff1efa74900efb8cee3f5047a Mon Sep 17 00:00:00 2001 From: Fatima <44647655+fatima196@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:40:18 +0200 Subject: [PATCH 11/78] Update SimpleSubscriber.java --- src/SimpleSubscriber.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/SimpleSubscriber.java b/src/SimpleSubscriber.java index 45fb4ff..c051520 100644 --- a/src/SimpleSubscriber.java +++ b/src/SimpleSubscriber.java @@ -1,6 +1,3 @@ -package SW2_git_assignment_CircleCircumference; - - public class SimpleSubscriber implements ISubscriber { @Override From 1ea35f98a84017a5d4a440142788e795d004b202 Mon Sep 17 00:00:00 2001 From: Fatima <44647655+fatima196@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:40:42 +0200 Subject: [PATCH 12/78] Update Topic.java --- src/Topic.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Topic.java b/src/Topic.java index 3a3a2de..8fa2e2e 100644 --- a/src/Topic.java +++ b/src/Topic.java @@ -1,5 +1,3 @@ -package SW2_git_assignment_CircleCircumference; - import java.util.ArrayList; import java.util.List; From d03c1deca3dca967751f22b6c7c35553cefa2d98 Mon Sep 17 00:00:00 2001 From: Abdulelah <58626327+AbdulelahAdam@users.noreply.github.com> Date: Sat, 29 Feb 2020 19:06:10 +0200 Subject: [PATCH 13/78] My Initial version of the assignment --- src/ISubscriber.class | Bin 0 -> 154 bytes src/Main.class | Bin 0 -> 1171 bytes src/Main.java | 1 + src/ReallySimpleSubscriber.class | Bin 0 -> 800 bytes src/SimpleSubscriber.class | Bin 0 -> 775 bytes src/SphereVolume.class | Bin 0 -> 1314 bytes src/SphereVolume.java | 32 +++++++++++++++++++++++++++++++ src/Topic.class | Bin 0 -> 1189 bytes 8 files changed, 33 insertions(+) create mode 100644 src/ISubscriber.class create mode 100644 src/Main.class create mode 100644 src/ReallySimpleSubscriber.class create mode 100644 src/SimpleSubscriber.class create mode 100644 src/SphereVolume.class create mode 100644 src/SphereVolume.java create mode 100644 src/Topic.class diff --git a/src/ISubscriber.class b/src/ISubscriber.class new file mode 100644 index 0000000000000000000000000000000000000000..fe408e49e06f565007fbecc6939dbe0133eb4091 GIT binary patch literal 154 zcmX^0Z`VEs1_pBmPId++Mh0%r;L@bx literal 0 HcmV?d00001 diff --git a/src/Main.class b/src/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..1b2fa6c72af7c8cb6c8e72444da1a0395dd770cd GIT binary patch literal 1171 zcmZuxT~8BH5IwiM?Y3p16ex&@0xGn8RS`ibf{LId1rwJvsXQ&)4J>ZAO}i!X?jP~V zXEA}qM&9+;_zTo?7s5xNN$;JVJu`FW%(TD%{x|_Ji!}`)0d?JUJPoQq`<}UPW?j?U z$-dj(vn^ksrQX=CTQz6fuGIzFw(@Jnxg#eKU9eoobNodCC7mfS*>a_1YiMEQC8UN{ zW;dL2)wM6;x88)Z9=E+k?Q zxTPbEh(IFmc=kr4Ov;<)wrdM?p95zc3KFF2?>g)&l9w8=AGOSz4ANWq z3oQ)4=6E}~OhLn-KzOrKb*wlBkdVg%9S<=q&}x=S7p<||^cAUOa9SW4WNrA4n>8%c z^Xys-qZrpPc13;Tpzhmc9TS)o2uVh%Q$9{5yXI9JJ}KE|ITyzW9!Uisv;FjqkW4{> zp6HmyQ}*ZCpE%X7bmn@0vYS~Q&oIYsN>06M`qu8szU?s}b(TEXjdMMi&#diGzs?)v z5{Q*ee>YG|K+6XPC04jmEO12~Hd(ir=9JWBc^D9OWXE!f*G9rThHqLQ*Uf4$RSh{! zu0Y(VG-{T;>d5KGPt-wkjha05Ix2D@X3s-EPh3MZ@7PIeQf*) z_dhG5Kc#;8_os=G;vq7}$ga~rwJ|nvgc(^@3D^&j7pO=SE$HKKa)5URZQPgy=E!;x z$$-*ypw1HJkt06JKad4HC#gRA7qP@Hry2PIFKNw@;wvn(!fRr?5&Fj?qG3g2dLcBd Nf|Uf`@NEch{{sTh^DqDa literal 0 HcmV?d00001 diff --git a/src/Main.java b/src/Main.java index 9b8c2b0..c823f20 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,6 +4,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + new SphereVolume(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); diff --git a/src/ReallySimpleSubscriber.class b/src/ReallySimpleSubscriber.class new file mode 100644 index 0000000000000000000000000000000000000000..94179cb01f5ce1f075364d2dd2865aa664f6289b GIT binary patch literal 800 zcmZuv%Wl&^6g`tBaq1dM(&ho>F{M0`w$w`&L0y1^s1#8|sz@v+@wA<4{E$5c<+EUs zN+9t8d=%o^jtC`L_|Dw%J!j56cYgi;{u97UxE4wbt&dV@Jsm1P(sG!NlS!<`GPY1= zxN{{w3s;Na!aW^d$%(O0W!N}blrdCasX&=yhP7^Q#87?{deX)kHXK-}F>DT0Am67x zah{2>mJE$SI1zdzVwL6d!?L+l2}5VFT27zD1ffyq(|_-7b_WZELldjuqTd^>V+&0S z+c)$Nr-_ligBIE(HB1ddvjD5m{Xj@Vcq#n8g}V&x|7l;RN_#S{VTa-Pozyx!!KI#lslzE{8hKdTJ%%;XN6N5br z(|97^s%)S;t7mqU-GW_^-}F`J&6Q}SM?rC&GM83HYi0i$_SgKkL$R74mT-&qPEml{ z*rbdGiaNy%e2OyB0qt*S{6ObZ=gHm4*49N>^h K$$6qH;ph*7^S%cF literal 0 HcmV?d00001 diff --git a/src/SimpleSubscriber.class b/src/SimpleSubscriber.class new file mode 100644 index 0000000000000000000000000000000000000000..a5fbbbdbbdf7860ecc4e71da66ecef88a44f802a GIT binary patch literal 775 zcmZuv%TC)s6g?A?I2gAyfe`vOg_Z;;Ub0BlMJrWBib^F{kyuXRDGaj5mOZB8v&te! zRO$!xqpIGqqoyQX_|Dwd@ww;Duiv*n0UW`zP+@rB%P0wjpO3O}Dn}x!JS$_UzmZDnw+u_&-jJdCJ`RM9C9F8G&|p{{NF_ey5n+Deqfjuk z2Jx7OL!L_GPlHu`E;EyxC(-UDsSVP;w`W@!}Ri;Jc zU;`Z@8RwdzT{g?u`%Imh`UQ{r79KKm=3(FEG7Lo8z+;A^k0K1?1NYeFk;~nz(9F&L ziso_^l*xjz6oLCq>T}n|CY~BSn&$T0fr~9tjwgvw0mJM64YM%clt|w|Y&+P&ONNGy z%i$T;yS;@Ls@+A;LYHB!nCtGu4))Mwuo5Fes2FNeB}SjtA`*k`$9XyyAEen~dwxxa z1|M4>iRr7+)2h%(FM#Yac^;jN&f4A$?C(X|AzLqk72Kn{Qx@PpR>`9sqDj^?pP))` yK<65*AJ{x?J-We@{Ry5;@M3~jGdQ~_vuM|i0&=5ln?e!*_HjU+iufX6kR7x;>1{`4JnsW26Inl=b9J`2jB)(@D zDO4cM2k<{UjWl8%CsGQ9ab%y1_g;Iib(Zt>zt8^wxQZ7B5&~Ae*O7s2_-@pd29g3( zuboY&2dS5Y=s8W0=ug9sM&7?swo43)TZM`Qb1G$GK(!&c`CdqFi|Kr1d@0B zwoKpp_AI`#5ZGyXU_p zsY0bvtYmQqVL5TXheki*ZPNBePKMDnAYB7}ZOKXAh!g?4;r&~5~T43L}2)C8D zu@Wh_ErSfs3Y=T-NP9Du+xB1Cjy+^xzg1y}s|~d&J-ecut_)?MBTN*rpk*krXkl12 zKAjq)OIFh?nN1dkdiXK| z$#a-1RQ|8p5|y`GQB$?-m{)&6C*QKLjN5cj=nuIFf9^u*}_2|zk6$zZSifEqnP<0-x=ZEUmyRo57tm3hOM*`F1qpNzM+>n8VH9R3` z&k6dHd%rn^s!5;ME$qX7DyzJn_DF7rc9hDj`%%!6_muYk^macl=;CxFEyg>=+tl9; z4V>gN%N4&vu1+DLT@51->u*f{#c2Xle5M(ogQw#iaK(>jlvLuV-=&=8db(kotXTnn;y%YDuAs^p<;Dp-ApZpC520yj z4c0j7c=OB_YD;rlcsi~y8NWF|1!u`(ZX3Ee;->!+*71xODgF%B(dZ50CGh+^38xkl literal 0 HcmV?d00001 diff --git a/src/SphereVolume.java b/src/SphereVolume.java new file mode 100644 index 0000000..3ce6b89 --- /dev/null +++ b/src/SphereVolume.java @@ -0,0 +1,32 @@ +import java.lang.Math; +public class SphereVolume implements ISubscriber { + + private static double value = 4.0/3.0; + + + + public static void sphereVolume(int diameter) { + /*calculating the volume of a sphere requires two constant inputs and a variable one. + + 1- (variable)a radius (which can be calculated from the given diameter). + 2- (constant)Pi, which simply = 3.14 or 22/7. + 3- (constant)the value (4/3). + + */ + int radius = diameter/2; + double volume = value*(Math.PI)*Math.pow(radius, 3); // value; + System.out.println("The volume of a sphere with a given Diameter of " + diameter + "cm = " + volume + " cubic meters."); + + + } + + @Override + public void notifySubscriber(String input) { + int value = Integer.parseInt(input); + sphereVolume(value); + + } + + + +} diff --git a/src/Topic.class b/src/Topic.class new file mode 100644 index 0000000000000000000000000000000000000000..298ca71d599d6f39a809945facb6d80bb2f290a3 GIT binary patch literal 1189 zcmZWn+fEZv6kTU%8QM+@lv2EMQ)F5$RlJ}ULGY506nrSD(YI+kmV0uyJ_E4j`5>GSL= ztNT}^BfV9DJ~LGi2t28k?J)WfH4s8r$DqJShhp7ztpmjqMhwvq1mXsQ=oc8wNypx9 zzN4%it5_v>JXb4O)q>?pb#Dg)-mauL!4|sM+eY%c^YZHM4Y!Bt4i!s@PtKlzQT3>WovAHgzs|-o9vAHtLpF+I_Zf zJDg6Bj=bker;<$-!Zd2uz!aucHz@;Y%n1xg&vq@Z<_aWxs5aa2Yy=C)=vbt{PVXmK z12=Jt6LakMBu<&ylWz_>J}9>P1|Hxc2efN7wtZmk z1$_)kr`{w@yvycxd$c$2S*5pIR^1=6jfQy!Z~sO z1vIrwJayhQ3?RUNZXv%BMmAU_cn+lxVWfW|_UaHr-!S~euO8ty=HsY$Aq?_ef-$4@ z2BS#wCNPEzZM>)C&{ReGD~9Kea8bj{4p!LDMadlVagwdtHjcubz$B5lCzxigrTLn# zG~>sCphEsk3Jpr0Y7H3fk`+9absaOzsy08cI>6IRf5(j@m;&3MkXSgvyufcPZOv2a z9SsaD3w%8Ot0edN_;LT;C|gWooXE3mRar3U+hU$dH<85(*~TbZHKE}Vs}j(T5k)|U R(6P$Y0 Date: Sat, 29 Feb 2020 19:31:00 +0200 Subject: [PATCH 14/78] Delete ISubscriber.class --- src/ISubscriber.class | Bin 154 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/ISubscriber.class diff --git a/src/ISubscriber.class b/src/ISubscriber.class deleted file mode 100644 index fe408e49e06f565007fbecc6939dbe0133eb4091..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 154 zcmX^0Z`VEs1_pBmPId++Mh0%r;L@bx From 21acc1b3785ccd542b811826d4ae90470736d3c5 Mon Sep 17 00:00:00 2001 From: Abdulelah <58626327+AbdulelahAdam@users.noreply.github.com> Date: Sat, 29 Feb 2020 19:31:29 +0200 Subject: [PATCH 15/78] Delete Main.class --- src/Main.class | Bin 1171 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/Main.class diff --git a/src/Main.class b/src/Main.class deleted file mode 100644 index 1b2fa6c72af7c8cb6c8e72444da1a0395dd770cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1171 zcmZuxT~8BH5IwiM?Y3p16ex&@0xGn8RS`ibf{LId1rwJvsXQ&)4J>ZAO}i!X?jP~V zXEA}qM&9+;_zTo?7s5xNN$;JVJu`FW%(TD%{x|_Ji!}`)0d?JUJPoQq`<}UPW?j?U z$-dj(vn^ksrQX=CTQz6fuGIzFw(@Jnxg#eKU9eoobNodCC7mfS*>a_1YiMEQC8UN{ zW;dL2)wM6;x88)Z9=E+k?Q zxTPbEh(IFmc=kr4Ov;<)wrdM?p95zc3KFF2?>g)&l9w8=AGOSz4ANWq z3oQ)4=6E}~OhLn-KzOrKb*wlBkdVg%9S<=q&}x=S7p<||^cAUOa9SW4WNrA4n>8%c z^Xys-qZrpPc13;Tpzhmc9TS)o2uVh%Q$9{5yXI9JJ}KE|ITyzW9!Uisv;FjqkW4{> zp6HmyQ}*ZCpE%X7bmn@0vYS~Q&oIYsN>06M`qu8szU?s}b(TEXjdMMi&#diGzs?)v z5{Q*ee>YG|K+6XPC04jmEO12~Hd(ir=9JWBc^D9OWXE!f*G9rThHqLQ*Uf4$RSh{! zu0Y(VG-{T;>d5KGPt-wkjha05Ix2D@X3s-EPh3MZ@7PIeQf*) z_dhG5Kc#;8_os=G;vq7}$ga~rwJ|nvgc(^@3D^&j7pO=SE$HKKa)5URZQPgy=E!;x z$$-*ypw1HJkt06JKad4HC#gRA7qP@Hry2PIFKNw@;wvn(!fRr?5&Fj?qG3g2dLcBd Nf|Uf`@NEch{{sTh^DqDa From c29f2a06c80b628a8b4524fdc535d5132c5bef62 Mon Sep 17 00:00:00 2001 From: Abdulelah <58626327+AbdulelahAdam@users.noreply.github.com> Date: Sat, 29 Feb 2020 19:31:52 +0200 Subject: [PATCH 16/78] Delete ReallySimpleSubscriber.class --- src/ReallySimpleSubscriber.class | Bin 800 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/ReallySimpleSubscriber.class diff --git a/src/ReallySimpleSubscriber.class b/src/ReallySimpleSubscriber.class deleted file mode 100644 index 94179cb01f5ce1f075364d2dd2865aa664f6289b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 800 zcmZuv%Wl&^6g`tBaq1dM(&ho>F{M0`w$w`&L0y1^s1#8|sz@v+@wA<4{E$5c<+EUs zN+9t8d=%o^jtC`L_|Dw%J!j56cYgi;{u97UxE4wbt&dV@Jsm1P(sG!NlS!<`GPY1= zxN{{w3s;Na!aW^d$%(O0W!N}blrdCasX&=yhP7^Q#87?{deX)kHXK-}F>DT0Am67x zah{2>mJE$SI1zdzVwL6d!?L+l2}5VFT27zD1ffyq(|_-7b_WZELldjuqTd^>V+&0S z+c)$Nr-_ligBIE(HB1ddvjD5m{Xj@Vcq#n8g}V&x|7l;RN_#S{VTa-Pozyx!!KI#lslzE{8hKdTJ%%;XN6N5br z(|97^s%)S;t7mqU-GW_^-}F`J&6Q}SM?rC&GM83HYi0i$_SgKkL$R74mT-&qPEml{ z*rbdGiaNy%e2OyB0qt*S{6ObZ=gHm4*49N>^h K$$6qH;ph*7^S%cF From 976495335959c6fd7d41602b1c66969a0af26f76 Mon Sep 17 00:00:00 2001 From: Abdulelah <58626327+AbdulelahAdam@users.noreply.github.com> Date: Sat, 29 Feb 2020 19:32:32 +0200 Subject: [PATCH 17/78] Delete SimpleSubscriber.class --- src/SimpleSubscriber.class | Bin 775 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/SimpleSubscriber.class diff --git a/src/SimpleSubscriber.class b/src/SimpleSubscriber.class deleted file mode 100644 index a5fbbbdbbdf7860ecc4e71da66ecef88a44f802a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 775 zcmZuv%TC)s6g?A?I2gAyfe`vOg_Z;;Ub0BlMJrWBib^F{kyuXRDGaj5mOZB8v&te! zRO$!xqpIGqqoyQX_|Dwd@ww;Duiv*n0UW`zP+@rB%P0wjpO3O}Dn}x!JS$_UzmZDnw+u_&-jJdCJ`RM9C9F8G&|p{{NF_ey5n+Deqfjuk z2Jx7OL!L_GPlHu`E;EyxC(-UDsSVP;w`W@!}Ri;Jc zU;`Z@8RwdzT{g?u`%Imh`UQ{r79KKm=3(FEG7Lo8z+;A^k0K1?1NYeFk;~nz(9F&L ziso_^l*xjz6oLCq>T}n|CY~BSn&$T0fr~9tjwgvw0mJM64YM%clt|w|Y&+P&ONNGy z%i$T;yS;@Ls@+A;LYHB!nCtGu4))Mwuo5Fes2FNeB}SjtA`*k`$9XyyAEen~dwxxa z1|M4>iRr7+)2h%(FM#Yac^;jN&f4A$?C(X|AzLqk72Kn{Qx@PpR>`9sqDj^?pP))` yK<65*AJ{x?J-We@{Ry5;@M3~jGdQ~_vuM|i0&=5ln?e!*_HjU Date: Sat, 29 Feb 2020 19:33:47 +0200 Subject: [PATCH 18/78] Delete SphereVolume.class --- src/SphereVolume.class | Bin 1314 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/SphereVolume.class diff --git a/src/SphereVolume.class b/src/SphereVolume.class deleted file mode 100644 index 4e027c95f0a4ed856a97c15cb7abe1da05fffe5e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1314 zcmaJ>+iufX6kR7x;>1{`4JnsW26Inl=b9J`2jB)(@D zDO4cM2k<{UjWl8%CsGQ9ab%y1_g;Iib(Zt>zt8^wxQZ7B5&~Ae*O7s2_-@pd29g3( zuboY&2dS5Y=s8W0=ug9sM&7?swo43)TZM`Qb1G$GK(!&c`CdqFi|Kr1d@0B zwoKpp_AI`#5ZGyXU_p zsY0bvtYmQqVL5TXheki*ZPNBePKMDnAYB7}ZOKXAh!g?4;r&~5~T43L}2)C8D zu@Wh_ErSfs3Y=T-NP9Du+xB1Cjy+^xzg1y}s|~d&J-ecut_)?MBTN*rpk*krXkl12 zKAjq)OIFh?nN1dkdiXK| z$#a-1RQ|8p5|y`GQB$?-m{)&6C*QKLjN5cj=nuIFf9^u*}_2|zk6$zZSifEqnP<0-x=ZEUmyRo57tm3hOM*`F1qpNzM+>n8VH9R3` z&k6dHd%rn^s!5;ME$qX7DyzJn_DF7rc9hDj`%%!6_muYk^macl=;CxFEyg>=+tl9; z4V>gN%N4&vu1+DLT@51->u*f{#c2Xle5M(ogQw#iaK(>jlvLuV-=&=8db(kotXTnn;y%YDuAs^p<;Dp-ApZpC520yj z4c0j7c=OB_YD;rlcsi~y8NWF|1!u`(ZX3Ee;->!+*71xODgF%B(dZ50CGh+^38xkl From 0071696e6f86560d2419a9777f37e9462925def5 Mon Sep 17 00:00:00 2001 From: Abdulelah <58626327+AbdulelahAdam@users.noreply.github.com> Date: Sat, 29 Feb 2020 19:34:26 +0200 Subject: [PATCH 19/78] Delete Topic.class --- src/Topic.class | Bin 1189 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/Topic.class diff --git a/src/Topic.class b/src/Topic.class deleted file mode 100644 index 298ca71d599d6f39a809945facb6d80bb2f290a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1189 zcmZWn+fEZv6kTU%8QM+@lv2EMQ)F5$RlJ}ULGY506nrSD(YI+kmV0uyJ_E4j`5>GSL= ztNT}^BfV9DJ~LGi2t28k?J)WfH4s8r$DqJShhp7ztpmjqMhwvq1mXsQ=oc8wNypx9 zzN4%it5_v>JXb4O)q>?pb#Dg)-mauL!4|sM+eY%c^YZHM4Y!Bt4i!s@PtKlzQT3>WovAHgzs|-o9vAHtLpF+I_Zf zJDg6Bj=bker;<$-!Zd2uz!aucHz@;Y%n1xg&vq@Z<_aWxs5aa2Yy=C)=vbt{PVXmK z12=Jt6LakMBu<&ylWz_>J}9>P1|Hxc2efN7wtZmk z1$_)kr`{w@yvycxd$c$2S*5pIR^1=6jfQy!Z~sO z1vIrwJayhQ3?RUNZXv%BMmAU_cn+lxVWfW|_UaHr-!S~euO8ty=HsY$Aq?_ef-$4@ z2BS#wCNPEzZM>)C&{ReGD~9Kea8bj{4p!LDMadlVagwdtHjcubz$B5lCzxigrTLn# zG~>sCphEsk3Jpr0Y7H3fk`+9absaOzsy08cI>6IRf5(j@m;&3MkXSgvyufcPZOv2a z9SsaD3w%8Ot0edN_;LT;C|gWooXE3mRar3U+hU$dH<85(*~TbZHKE}Vs}j(T5k)|U R(6P$Y0 Date: Sat, 29 Feb 2020 19:40:06 +0200 Subject: [PATCH 20/78] Function takes a double instead of int. --- src/SphereVolume.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SphereVolume.java b/src/SphereVolume.java index 3ce6b89..2a29799 100644 --- a/src/SphereVolume.java +++ b/src/SphereVolume.java @@ -5,7 +5,7 @@ public class SphereVolume implements ISubscriber { - public static void sphereVolume(int diameter) { + public static void sphereVolume(double diameter) { /*calculating the volume of a sphere requires two constant inputs and a variable one. 1- (variable)a radius (which can be calculated from the given diameter). @@ -13,7 +13,7 @@ public static void sphereVolume(int diameter) { 3- (constant)the value (4/3). */ - int radius = diameter/2; + double radius = diameter/2; double volume = value*(Math.PI)*Math.pow(radius, 3); // value; System.out.println("The volume of a sphere with a given Diameter of " + diameter + "cm = " + volume + " cubic meters."); @@ -22,7 +22,7 @@ public static void sphereVolume(int diameter) { @Override public void notifySubscriber(String input) { - int value = Integer.parseInt(input); + double value = Double.parseDouble(input); sphereVolume(value); } From 33c6e0ca695c34b9058d49e3e7da9dfe10051c3f Mon Sep 17 00:00:00 2001 From: merna ezzat Date: Sun, 1 Mar 2020 10:59:38 +0200 Subject: [PATCH 21/78] adding new class CircleArea --- src/CircleArea.java | 27 +++++++++++++++++++++++++++ src/Main.java | 1 + 2 files changed, 28 insertions(+) create mode 100644 src/CircleArea.java diff --git a/src/CircleArea.java b/src/CircleArea.java new file mode 100644 index 0000000..f9574c1 --- /dev/null +++ b/src/CircleArea.java @@ -0,0 +1,27 @@ + +public class CircleArea implements ISubscriber { + + @Override + public void notifySubscriber(String input) { + System.out.println("Hello, I am Circle Area and I am notified with " + input); + + double radius; + try { + radius = Double.parseDouble(input); + if (radius < 0) { + System.out.println("Radius is negative."); + return; + } + + } catch (NumberFormatException ignored) { + System.out.println("Radius is not a number."); + return; + } + + System.out.println("Radius is " + radius + ", Circle Area is: " + calculat(radius)); + } + + public double calculat(double input) { + return Math.PI * input *input; + } +} diff --git a/src/Main.java b/src/Main.java index 9b8c2b0..4dfe564 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,6 +4,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + new CircleArea(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); From 520b6b1b8d7909866046f29d771a921487052bbd Mon Sep 17 00:00:00 2001 From: marim medhat Date: Sun, 1 Mar 2020 11:19:39 +0200 Subject: [PATCH 22/78] adding new class CircleArea by 20170282 --- src/CircleArea.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CircleArea.java b/src/CircleArea.java index f9574c1..150d8cc 100644 --- a/src/CircleArea.java +++ b/src/CircleArea.java @@ -18,7 +18,7 @@ public void notifySubscriber(String input) { return; } - System.out.println("Radius is " + radius + ", Circle Area is: " + calculat(radius)); + System.out.println("Radius is " + radius + ", Area is: " + calculat(radius)); } public double calculat(double input) { From 779391eccb1dce7c152e2fbeb63e5c45507fab56 Mon Sep 17 00:00:00 2001 From: Amr Magdy <36246549+amrmagdy12@users.noreply.github.com> Date: Sun, 1 Mar 2020 18:40:18 +0200 Subject: [PATCH 23/78] Initialversion added a class Fibonacci which calculates the fibonacci series for large numbers and have a minor changes in Main --- src/Fibonacci.java | 35 +++++++++++++++++++++++++++++++++++ src/Main.java | 6 ++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/Fibonacci.java diff --git a/src/Fibonacci.java b/src/Fibonacci.java new file mode 100644 index 0000000..c85019e --- /dev/null +++ b/src/Fibonacci.java @@ -0,0 +1,35 @@ +package com.company ; +public class Fibonacci implements ISubscriber { + @Override + public void notifySubscriber(int n) { + int pascTriangle[][] = new int [n][n] ; + pascTriangle[1][0] = 1; + pascTriangle[1][1] = 1; + + if (n == 1 || n == 2) System.out.println("Result is:" +1) ; + else { + // drawing pascal's triangle as a base for Fibonnacii + for (int i = 2; i <= n; i++) { + pascTriangle[i][0] = 1; + for (int j = 1; j <= i; j++) { + pascTriangle[i][j] = pascTriangle[i - 1][j - 1] + pascTriangle[i - 1][j]; + } + pascTriangle[i][i] = 1; + } + + int i = n - 1; + int j = 0; + int result = 0; + + while (j <= i) + { + result += pascTriangle[i][j]; + i--; + j++; + + } + + System.out.println("Result is:" +result) ; + } + } +} diff --git a/src/Main.java b/src/Main.java index 9b8c2b0..5187553 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,9 +1,11 @@ +package com.company; + import java.util.Scanner; public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), - new ReallySimpleSubscriber(), + new Fibonacci(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); @@ -11,7 +13,7 @@ public static void main(String[] args) { mathTopic.addSubscriber(sub); } Scanner sc = new Scanner(System.in); - String input = sc.next(); + int input = sc.nextInt() ; mathTopic.dispatchEvent(input); } } From c6a4b90e9a5ce9f73d933c4cad8837cc2d8eb289 Mon Sep 17 00:00:00 2001 From: Abdulelah <58626327+AbdulelahAdam@users.noreply.github.com> Date: Sun, 1 Mar 2020 19:22:58 +0200 Subject: [PATCH 24/78] Function now takes the radius instead of a diameter. --- src/SphereVolume.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SphereVolume.java b/src/SphereVolume.java index 2a29799..2b3b9a8 100644 --- a/src/SphereVolume.java +++ b/src/SphereVolume.java @@ -5,17 +5,17 @@ public class SphereVolume implements ISubscriber { - public static void sphereVolume(double diameter) { + public static void sphereVolume(double radius) { /*calculating the volume of a sphere requires two constant inputs and a variable one. - 1- (variable)a radius (which can be calculated from the given diameter). + 1- (variable)a radius (which is given). 2- (constant)Pi, which simply = 3.14 or 22/7. 3- (constant)the value (4/3). - */ - double radius = diameter/2; - double volume = value*(Math.PI)*Math.pow(radius, 3); // value; - System.out.println("The volume of a sphere with a given Diameter of " + diameter + "cm = " + volume + " cubic meters."); + */ + + double volume = value*(Math.PI)*Math.pow(radius, 3); + System.out.println("The volume of a sphere with a given Radius of " + radius + "cm = " + volume + " cubic meters."); } From 0ebc25cc7f3f284be375f8be00f62de105f7fe8e Mon Sep 17 00:00:00 2001 From: mohamed magdy <36678529+devmagdyy@users.noreply.github.com> Date: Sun, 1 Mar 2020 19:43:44 +0200 Subject: [PATCH 25/78] 20160219-MultiplicationSeise I add my class called (MultiplicationSeriess) , it recive interger value therefor i change every string in src code from string to int , because i think we all use integer value in in him function , --- .idea/.name | 1 + .idea/misc.xml | 6 ++++ .idea/modules.xml | 8 +++++ .idea/vcs.xml | 6 ++++ .idea/workspace.xml | 58 ++++++++++++++++++++++++++++++++++ GitAssignmentObserver.iml | 12 +++++++ src/ISubscriber.java | 2 +- src/Main.java | 3 +- src/Multiplicationseriess.java | 14 ++++++++ src/Topic.java | 2 +- 10 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 .idea/.name create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 GitAssignmentObserver.iml create mode 100644 src/Multiplicationseriess.java diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..477e576 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +GitAssignmentObserver \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ba93b15 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3dd0b66 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..6b1befe --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 1583076785152 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GitAssignmentObserver.iml b/GitAssignmentObserver.iml new file mode 100644 index 0000000..26db12c --- /dev/null +++ b/GitAssignmentObserver.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ISubscriber.java b/src/ISubscriber.java index d3a605c..7e3d582 100644 --- a/src/ISubscriber.java +++ b/src/ISubscriber.java @@ -1,4 +1,4 @@ public interface ISubscriber { - public abstract void notifySubscriber(String input); + public abstract void notifySubscriber(int input); } diff --git a/src/Main.java b/src/Main.java index 9b8c2b0..f880665 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,6 +4,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + }; public static void main(String[] args) { Topic mathTopic = new Topic(); @@ -11,7 +12,7 @@ public static void main(String[] args) { mathTopic.addSubscriber(sub); } Scanner sc = new Scanner(System.in); - String input = sc.next(); + int input = sc.nextInt(); mathTopic.dispatchEvent(input); } } diff --git a/src/Multiplicationseriess.java b/src/Multiplicationseriess.java new file mode 100644 index 0000000..6e131e3 --- /dev/null +++ b/src/Multiplicationseriess.java @@ -0,0 +1,14 @@ +public class Multiplicationseriess implements ISubscriber { + public int m(int n){ + int result = 1; + for(int i=0; i<=n; i++){ + result = result*i; + } + return result; + } + @Override + public void notifySubscriber(int input) { + System.out.println("Hello, I am really a simple subscriber and I am notified with " + input); + System.out.println("and my result is : " + m(input)); + } +} diff --git a/src/Topic.java b/src/Topic.java index 8fa2e2e..c147e76 100644 --- a/src/Topic.java +++ b/src/Topic.java @@ -17,7 +17,7 @@ public List getSubscribers() { return subscribers; } - public void dispatchEvent(String input) { + public void dispatchEvent(int input) { for (ISubscriber sub : this.getSubscribers()) { sub.notifySubscriber(input); } From 42dbb2230364e784e3efdec889eeadf510395005 Mon Sep 17 00:00:00 2001 From: Abdulazizsayed Date: Sun, 1 Mar 2020 21:09:43 +0200 Subject: [PATCH 26/78] Initial code for two power N --- src/Main.java | 1 + src/TowPowerN.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/TowPowerN.java diff --git a/src/Main.java b/src/Main.java index 9b8c2b0..f6f808f 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,6 +4,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + new TowPowerN(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); diff --git a/src/TowPowerN.java b/src/TowPowerN.java new file mode 100644 index 0000000..052bf44 --- /dev/null +++ b/src/TowPowerN.java @@ -0,0 +1,13 @@ + +public class TowPowerN implements ISubscriber { + @Override + public void notifySubscriber(String input) { + int p = Integer.parseInt(input), res = 2; + + for(int i = 1 ; i < p ; i++){ + res += res; + } + + System.out.println(res); + } +} \ No newline at end of file From 2fa8601008cc37961cbe33faf0aa55abf61760e8 Mon Sep 17 00:00:00 2001 From: Ahmed Dardery Date: Sun, 1 Mar 2020 23:19:52 +0200 Subject: [PATCH 27/78] no packaging --- src/Fibonacci.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Fibonacci.java b/src/Fibonacci.java index c85019e..8641aa3 100644 --- a/src/Fibonacci.java +++ b/src/Fibonacci.java @@ -1,4 +1,3 @@ -package com.company ; public class Fibonacci implements ISubscriber { @Override public void notifySubscriber(int n) { From 7430a189825255ae9a7479eb48568fc0655de7dc Mon Sep 17 00:00:00 2001 From: Ahmed Dardery Date: Sun, 1 Mar 2020 23:20:48 +0200 Subject: [PATCH 28/78] do NOT violate the subscriber format --- src/Fibonacci.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Fibonacci.java b/src/Fibonacci.java index 8641aa3..69bc013 100644 --- a/src/Fibonacci.java +++ b/src/Fibonacci.java @@ -1,6 +1,7 @@ public class Fibonacci implements ISubscriber { @Override - public void notifySubscriber(int n) { + public void notifySubscriber(String s) { + int n = Integer.parseInt(s); int pascTriangle[][] = new int [n][n] ; pascTriangle[1][0] = 1; pascTriangle[1][1] = 1; From a2a72018a99986d3ddbfd8133d066224159b9073 Mon Sep 17 00:00:00 2001 From: Ahmed Dardery Date: Sun, 1 Mar 2020 23:21:08 +0200 Subject: [PATCH 29/78] Update Main.java --- src/Main.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Main.java b/src/Main.java index b13bb11..eaaee8b 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,5 +1,3 @@ -package com.company; - import java.util.Scanner; public class Main { @@ -15,7 +13,7 @@ public static void main(String[] args) { mathTopic.addSubscriber(sub); } Scanner sc = new Scanner(System.in); - int input = sc.nextInt() ; + String input = sc.next() ; mathTopic.dispatchEvent(input); } } From 9c20c22d15ad176784a3fe7662240f38819d0a20 Mon Sep 17 00:00:00 2001 From: Ahmed Dardery Date: Sun, 1 Mar 2020 23:21:29 +0200 Subject: [PATCH 30/78] spacing --- src/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Main.java b/src/Main.java index eaaee8b..085e6cb 100644 --- a/src/Main.java +++ b/src/Main.java @@ -13,7 +13,7 @@ public static void main(String[] args) { mathTopic.addSubscriber(sub); } Scanner sc = new Scanner(System.in); - String input = sc.next() ; + String input = sc.next(); mathTopic.dispatchEvent(input); } } From 37d2b5170e8fccb8a53ed21378c22e90bca11a4c Mon Sep 17 00:00:00 2001 From: Ahmed Dardery Date: Sun, 1 Mar 2020 23:53:34 +0200 Subject: [PATCH 31/78] broken fibonacci crashes for 5 --- src/Fibonacci.java | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/Fibonacci.java diff --git a/src/Fibonacci.java b/src/Fibonacci.java deleted file mode 100644 index 69bc013..0000000 --- a/src/Fibonacci.java +++ /dev/null @@ -1,35 +0,0 @@ -public class Fibonacci implements ISubscriber { - @Override - public void notifySubscriber(String s) { - int n = Integer.parseInt(s); - int pascTriangle[][] = new int [n][n] ; - pascTriangle[1][0] = 1; - pascTriangle[1][1] = 1; - - if (n == 1 || n == 2) System.out.println("Result is:" +1) ; - else { - // drawing pascal's triangle as a base for Fibonnacii - for (int i = 2; i <= n; i++) { - pascTriangle[i][0] = 1; - for (int j = 1; j <= i; j++) { - pascTriangle[i][j] = pascTriangle[i - 1][j - 1] + pascTriangle[i - 1][j]; - } - pascTriangle[i][i] = 1; - } - - int i = n - 1; - int j = 0; - int result = 0; - - while (j <= i) - { - result += pascTriangle[i][j]; - i--; - j++; - - } - - System.out.println("Result is:" +result) ; - } - } -} From 8ddacdc815f4d3e622c855c5a1ce7e7b16b9f702 Mon Sep 17 00:00:00 2001 From: Ahmed Dardery Date: Sun, 1 Mar 2020 23:54:02 +0200 Subject: [PATCH 32/78] broken fibonacci --- src/Main.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Main.java b/src/Main.java index 1d5c67b..15f899b 100644 --- a/src/Main.java +++ b/src/Main.java @@ -5,9 +5,8 @@ public class Main { new SimpleSubscriber(), new ReallySimpleSubscriber(), new SphereCircumference(), - new Fibonacci(), - new SphereVolume(), - new CircleCircumference(), + new SphereVolume(), + new CircleCircumference(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); From 2259809e8604467b2f54db2015fd138924000d24 Mon Sep 17 00:00:00 2001 From: Ahmed Dardery Date: Mon, 2 Mar 2020 00:06:18 +0200 Subject: [PATCH 33/78] changed input to int. --- src/SphereCircumference.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SphereCircumference.java b/src/SphereCircumference.java index 1c2c086..bc0374e 100644 --- a/src/SphereCircumference.java +++ b/src/SphereCircumference.java @@ -3,9 +3,9 @@ public class SphereCircumference implements ISubscriber { public void notifySubscriber(String input) { System.out.println("Hello, I am Sphere Circumference and I am notified with " + input); - double radius; + int radius; try { - radius = Double.parseDouble(input); + radius = Integer.parseInt(input); if (radius < 0) { System.out.println("Radius is negative."); return; @@ -19,7 +19,7 @@ public void notifySubscriber(String input) { System.out.println("Radius is " + radius + ", Sphere Circumference is: " + doCalculation(radius)); } - public double doCalculation(double input) { + public double doCalculation(int input) { return 2 * Math.PI * input; } } From 18857149bcf3bb5af6ea939a3601c0425af75a2b Mon Sep 17 00:00:00 2001 From: Megadardery Date: Mon, 2 Mar 2020 00:33:14 +0200 Subject: [PATCH 34/78] preperation for bonus added IntegerSubscriber and DoubleSubscriber, each class should extend one of them and overrides the abstract methods --- src/CircleCircumference.java | 6 +++--- src/DoubleSubscriber.java | 10 ++++++++++ src/Fibonacci.java | 35 --------------------------------- src/ISubscriber.java | 2 +- src/IntegerSubscriber.java | 10 ++++++++++ src/Main.java | 12 +++++++---- src/ReallySimpleSubscriber.java | 2 +- src/SimpleSubscriber.java | 2 +- src/SphereCircumference.java | 29 ++++++++++----------------- src/SphereVolume.java | 8 +++----- src/Topic.java | 9 +++++++-- 11 files changed, 54 insertions(+), 71 deletions(-) create mode 100644 src/DoubleSubscriber.java delete mode 100644 src/Fibonacci.java create mode 100644 src/IntegerSubscriber.java diff --git a/src/CircleCircumference.java b/src/CircleCircumference.java index 3b088d3..a48123e 100644 --- a/src/CircleCircumference.java +++ b/src/CircleCircumference.java @@ -3,16 +3,16 @@ public class CircleCircumference implements ISubscriber { @Override - public void notifySubscriber(String input) { + public void notifySubscriber(int input) { // TODO Auto-generated method stub System.out.println("Hello, I am CircleCircumference subscriber and I am notified with " + input); display(input); } - void display(String input){ // accept input and check if valid or not then call get_CircleCircumference and display the result. + void display(int input){ // accept input and check if valid or not then call get_CircleCircumference and display the result. double radius=0; try{ //check if the input can converted to double or not .. - radius=Double.valueOf(input); // convert input String to double. + radius=input; // convert input String to double. }catch (NumberFormatException e) { System.out.println(" invalid input "); System.out.println(" "+ e.getMessage()); diff --git a/src/DoubleSubscriber.java b/src/DoubleSubscriber.java new file mode 100644 index 0000000..a1a5702 --- /dev/null +++ b/src/DoubleSubscriber.java @@ -0,0 +1,10 @@ +public abstract class DoubleSubscriber implements ISubscriber { + public void notifySubscriber(int input) throws Exception{ + preProcess(input); + double ans = doCalculation(input); + printAnswer(ans); + } + public abstract void preProcess(int input) throws Exception; + public abstract double doCalculation(int input); + public abstract void printAnswer(double output); +} diff --git a/src/Fibonacci.java b/src/Fibonacci.java deleted file mode 100644 index 69bc013..0000000 --- a/src/Fibonacci.java +++ /dev/null @@ -1,35 +0,0 @@ -public class Fibonacci implements ISubscriber { - @Override - public void notifySubscriber(String s) { - int n = Integer.parseInt(s); - int pascTriangle[][] = new int [n][n] ; - pascTriangle[1][0] = 1; - pascTriangle[1][1] = 1; - - if (n == 1 || n == 2) System.out.println("Result is:" +1) ; - else { - // drawing pascal's triangle as a base for Fibonnacii - for (int i = 2; i <= n; i++) { - pascTriangle[i][0] = 1; - for (int j = 1; j <= i; j++) { - pascTriangle[i][j] = pascTriangle[i - 1][j - 1] + pascTriangle[i - 1][j]; - } - pascTriangle[i][i] = 1; - } - - int i = n - 1; - int j = 0; - int result = 0; - - while (j <= i) - { - result += pascTriangle[i][j]; - i--; - j++; - - } - - System.out.println("Result is:" +result) ; - } - } -} diff --git a/src/ISubscriber.java b/src/ISubscriber.java index d3a605c..e3de552 100644 --- a/src/ISubscriber.java +++ b/src/ISubscriber.java @@ -1,4 +1,4 @@ public interface ISubscriber { - public abstract void notifySubscriber(String input); + public abstract void notifySubscriber(int input) throws Exception; } diff --git a/src/IntegerSubscriber.java b/src/IntegerSubscriber.java new file mode 100644 index 0000000..2843c0d --- /dev/null +++ b/src/IntegerSubscriber.java @@ -0,0 +1,10 @@ +public abstract class IntegerSubscriber implements ISubscriber { + public void notifySubscriber(int input) throws Exception{ + preProcess(input); + int ans = doCalculation(input); + printAnswer(ans); + } + public abstract void preProcess(int input) throws Exception; + public abstract int doCalculation(int input); + public abstract void printAnswer(int output); +} diff --git a/src/Main.java b/src/Main.java index 1d5c67b..d59e59a 100644 --- a/src/Main.java +++ b/src/Main.java @@ -5,9 +5,8 @@ public class Main { new SimpleSubscriber(), new ReallySimpleSubscriber(), new SphereCircumference(), - new Fibonacci(), - new SphereVolume(), - new CircleCircumference(), + new SphereVolume(), + new CircleCircumference(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); @@ -16,6 +15,11 @@ public static void main(String[] args) { } Scanner sc = new Scanner(System.in); String input = sc.next(); - mathTopic.dispatchEvent(input); + try{ + int n = Integer.parseInt(input); + mathTopic.dispatchEvent(n); + }catch(NumberFormatException ignored) { + System.out.println("Your input is not a valid integer."); + } } } diff --git a/src/ReallySimpleSubscriber.java b/src/ReallySimpleSubscriber.java index fb1114a..33ae146 100644 --- a/src/ReallySimpleSubscriber.java +++ b/src/ReallySimpleSubscriber.java @@ -1,7 +1,7 @@ public class ReallySimpleSubscriber implements ISubscriber { @Override - public void notifySubscriber(String input) { + public void notifySubscriber(int input) { // TODO Auto-generated method stub System.out.println("Hello, I am really a simple subscriber and I am notified with " + input); } diff --git a/src/SimpleSubscriber.java b/src/SimpleSubscriber.java index c051520..bd70164 100644 --- a/src/SimpleSubscriber.java +++ b/src/SimpleSubscriber.java @@ -1,7 +1,7 @@ public class SimpleSubscriber implements ISubscriber { @Override - public void notifySubscriber(String input) { + public void notifySubscriber(int input) { // TODO Auto-generated method stub System.out.println("Hello, I am a simple subscriber and I am notified with " + input); } diff --git a/src/SphereCircumference.java b/src/SphereCircumference.java index 1c2c086..55eea01 100644 --- a/src/SphereCircumference.java +++ b/src/SphereCircumference.java @@ -1,25 +1,16 @@ -public class SphereCircumference implements ISubscriber { +public class SphereCircumference extends DoubleSubscriber { @Override - public void notifySubscriber(String input) { - System.out.println("Hello, I am Sphere Circumference and I am notified with " + input); - - double radius; - try { - radius = Double.parseDouble(input); - if (radius < 0) { - System.out.println("Radius is negative."); - return; - } - - } catch (NumberFormatException ignored) { - System.out.println("Radius is not a number."); - return; - } - - System.out.println("Radius is " + radius + ", Sphere Circumference is: " + doCalculation(radius)); + public void preProcess(int input) throws Exception { + System.out.print("Hello, I'm SphereCircumference, and I'm notified with: " + input + " as radius. "); + if (input < 0) throw new Exception("Negative radius is invalid!"); } - public double doCalculation(double input) { + public double doCalculation(int input) { return 2 * Math.PI * input; } + + @Override + public void printAnswer(double output) { + System.out.println("Sphere Circumference is: " + output); + } } diff --git a/src/SphereVolume.java b/src/SphereVolume.java index 2b3b9a8..72dd7a3 100644 --- a/src/SphereVolume.java +++ b/src/SphereVolume.java @@ -5,7 +5,7 @@ public class SphereVolume implements ISubscriber { - public static void sphereVolume(double radius) { + public static void sphereVolume(int radius) { /*calculating the volume of a sphere requires two constant inputs and a variable one. 1- (variable)a radius (which is given). @@ -21,10 +21,8 @@ public static void sphereVolume(double radius) { } @Override - public void notifySubscriber(String input) { - double value = Double.parseDouble(input); - sphereVolume(value); - + public void notifySubscriber(int input) { + sphereVolume(input); } diff --git a/src/Topic.java b/src/Topic.java index 8fa2e2e..27c7832 100644 --- a/src/Topic.java +++ b/src/Topic.java @@ -17,9 +17,14 @@ public List getSubscribers() { return subscribers; } - public void dispatchEvent(String input) { + public void dispatchEvent(int input) { for (ISubscriber sub : this.getSubscribers()) { - sub.notifySubscriber(input); + try { + sub.notifySubscriber(input); + } + catch(Exception ex){ + System.out.println(ex.getMessage()); + } } } } From c5ac0225b55453fa36e978a6baee31a7590919e4 Mon Sep 17 00:00:00 2001 From: Fatima <44647655+fatima196@users.noreply.github.com> Date: Mon, 2 Mar 2020 00:59:17 +0200 Subject: [PATCH 35/78] Change type of input to integer. --- src/CircleCircumference.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CircleCircumference.java b/src/CircleCircumference.java index 3b088d3..8595772 100644 --- a/src/CircleCircumference.java +++ b/src/CircleCircumference.java @@ -10,15 +10,15 @@ public void notifySubscriber(String input) { } void display(String input){ // accept input and check if valid or not then call get_CircleCircumference and display the result. - double radius=0; - try{ //check if the input can converted to double or not .. - radius=Double.valueOf(input); // convert input String to double. + int radius=0; + try{ //check if the input can converted to integer or not .. + radius=Integer.parseInt(input); // convert input String to integer. + if (radius<0) {System.out.println(" Sorry,You enterd invalid radius. "); return; } //its invalid if the input radius < 0. }catch (NumberFormatException e) { System.out.println(" invalid input "); System.out.println(" "+ e.getMessage()); return; - } - if (radius<0) {System.out.println(" Sorry,You enterd invalid radius. "); return; } //its invalid if the input radius < 0. + } double circumference = get_CircleCircumference(radius); System.out.println(" Circumference of a Circle = " + circumference); } From b62da27d4b6ed1f3f56e04c79556c0c18c4bf0cc Mon Sep 17 00:00:00 2001 From: Marim-medhat <36182751+Marim-medhat@users.noreply.github.com> Date: Mon, 2 Mar 2020 10:39:06 +0200 Subject: [PATCH 36/78] Update CircleArea.java --- src/CircleArea.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CircleArea.java b/src/CircleArea.java index 150d8cc..92e7b29 100644 --- a/src/CircleArea.java +++ b/src/CircleArea.java @@ -5,9 +5,9 @@ public class CircleArea implements ISubscriber { public void notifySubscriber(String input) { System.out.println("Hello, I am Circle Area and I am notified with " + input); - double radius; + int radius; try { - radius = Double.parseDouble(input); + radius = Integer.parseDouble(input); if (radius < 0) { System.out.println("Radius is negative."); return; @@ -21,7 +21,7 @@ public void notifySubscriber(String input) { System.out.println("Radius is " + radius + ", Area is: " + calculat(radius)); } - public double calculat(double input) { + public double calculat(int input) { return Math.PI * input *input; } } From f9aec7a997fbda5d08413c2292552574ac6ca59b Mon Sep 17 00:00:00 2001 From: Marim-medhat <36182751+Marim-medhat@users.noreply.github.com> Date: Mon, 2 Mar 2020 17:21:29 +0200 Subject: [PATCH 37/78] Update CircleArea.java --- src/CircleArea.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CircleArea.java b/src/CircleArea.java index 92e7b29..93b7459 100644 --- a/src/CircleArea.java +++ b/src/CircleArea.java @@ -7,7 +7,7 @@ public void notifySubscriber(String input) { int radius; try { - radius = Integer.parseDouble(input); + radius = Integer.parseInt(input); if (radius < 0) { System.out.println("Radius is negative."); return; From e80e370f933c7b0a9132e461ea963ed0ad336fe7 Mon Sep 17 00:00:00 2001 From: mahmoud-mohamed-abozied <36476250+mahmoud-mohamed-abozied@users.noreply.github.com> Date: Mon, 2 Mar 2020 18:25:49 +0200 Subject: [PATCH 38/78] 20170270-Adding SummationSeries class --- src/Main.java | 1 + src/SummationSeries.java | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 src/SummationSeries.java diff --git a/src/Main.java b/src/Main.java index a0cf2f6..05d378f 100644 --- a/src/Main.java +++ b/src/Main.java @@ -7,6 +7,7 @@ public class Main { new SphereCircumference(), new SphereVolume(), new CircleCircumference(), + new SummationSeries(), new CircleArea(), }; public static void main(String[] args) { diff --git a/src/SummationSeries.java b/src/SummationSeries.java new file mode 100644 index 0000000..e0f9465 --- /dev/null +++ b/src/SummationSeries.java @@ -0,0 +1,10 @@ +public class SummationSeries implements ISubscriber { + + @Override + public void notifySubscriber(String input) { + int sum=((Integer.parseInt(input) * (Integer.parseInt(input)+1))) / 2 ; + System.out.println("The summation of series = " + sum); + + } + +} From 8867a5fa7fb7ecb282d00f325fd2b2de7f494ec6 Mon Sep 17 00:00:00 2001 From: Abdulazizsayed Date: Mon, 2 Mar 2020 21:39:27 +0200 Subject: [PATCH 39/78] Modification of class name --- src/Main.java | 2 +- src/TwoPowerN.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/TwoPowerN.java diff --git a/src/Main.java b/src/Main.java index f6f808f..1df1b4c 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,7 +4,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), - new TowPowerN(), + new TwoPowerN(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); diff --git a/src/TwoPowerN.java b/src/TwoPowerN.java new file mode 100644 index 0000000..206f29d --- /dev/null +++ b/src/TwoPowerN.java @@ -0,0 +1,13 @@ + +public class TwoPowerN implements ISubscriber { + @Override + public void notifySubscriber(String input) { + int p = Integer.parseInt(input), res = 2; + + for(int i = 1 ; i < p ; i++){ + res += res; + } + + System.out.println(res); + } +} \ No newline at end of file From c56c8068697b10ec5bd5e78c0b66124faf38438e Mon Sep 17 00:00:00 2001 From: Abdulaziz Sayed <36112643+Abdulazizsayed@users.noreply.github.com> Date: Mon, 2 Mar 2020 21:56:24 +0200 Subject: [PATCH 40/78] TowPowerN.java was deleted It was deleted because it replaced by TwoPowerN.java class --- src/TowPowerN.java | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 src/TowPowerN.java diff --git a/src/TowPowerN.java b/src/TowPowerN.java deleted file mode 100644 index 052bf44..0000000 --- a/src/TowPowerN.java +++ /dev/null @@ -1,13 +0,0 @@ - -public class TowPowerN implements ISubscriber { - @Override - public void notifySubscriber(String input) { - int p = Integer.parseInt(input), res = 2; - - for(int i = 1 ; i < p ; i++){ - res += res; - } - - System.out.println(res); - } -} \ No newline at end of file From 377f89e60e20ed961c65a1c53adeb17fd4d00782 Mon Sep 17 00:00:00 2001 From: Mina Botros <36329091+Mina1998@users.noreply.github.com> Date: Mon, 2 Mar 2020 22:04:00 +0200 Subject: [PATCH 41/78] Version 2 --- src/CircleVolume.class | Bin 545 -> 0 bytes src/CircleVolume.java | 5 +++-- src/ISubscriber.class | Bin 154 -> 0 bytes src/Main.class | Bin 1171 -> 0 bytes src/ReallySimpleSubscriber.class | Bin 800 -> 0 bytes src/SimpleSubscriber.class | Bin 775 -> 0 bytes src/Topic.class | Bin 1189 -> 0 bytes 7 files changed, 3 insertions(+), 2 deletions(-) delete mode 100644 src/CircleVolume.class delete mode 100644 src/ISubscriber.class delete mode 100644 src/Main.class delete mode 100644 src/ReallySimpleSubscriber.class delete mode 100644 src/SimpleSubscriber.class delete mode 100644 src/Topic.class diff --git a/src/CircleVolume.class b/src/CircleVolume.class deleted file mode 100644 index bf4b907a0673538fbb06a3f522199df2f72b4bcc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 545 zcmZXR%TB^j5QhILmqMu^Meu&#fD3VHf-x~BCMHBpFznlU#6x-^r8VKPbfJk0AHat) z&M727Ty&;$&iwy;)BgN^eFHehu?~%3Udzb!L_hQrU+BmZR)_Yh-S+HY(7tzu!i{z0 z38mX!;*8x$IwB(EFJvI&OG2jE>Jzfp;gc|sLCJ)U0-@5Cfw)V2Zho{KPY|qb=-OW2 zj-;w*huQc=jtS-NB1DG~f-siPlf{YkW_Qljiz68fI<0;YHPm&iEm8L-<5>768dzt* zFo_BEsaS^X2UfnM=W=l*h7_|kCf002ss&yl&AF{h+y=> zByz=#R6AD}*E&_+I0Pf{ljC2YapteZvB*`MGjYzHe8PB3uT75m^iabJznjwrlu_Y| tcSeeH^e2F`HsK`U8;mZzcc$ diff --git a/src/CircleVolume.java b/src/CircleVolume.java index f8743dc..a29073c 100644 --- a/src/CircleVolume.java +++ b/src/CircleVolume.java @@ -3,8 +3,9 @@ public class CircleVolume implements ISubscriber { @Override public void notifySubscriber(String input) { - // TODO Auto-generated method stub - System.out.println("0"); + int radius = Integer.parseInt(input); + double CircleVolume = (4.0/3.0) * Math.PI * Math.pow(radius, 3); + System.out.println("The Volume of the Circle is : " + CircleVolume); } } diff --git a/src/ISubscriber.class b/src/ISubscriber.class deleted file mode 100644 index a83512f2b788a72f2112d3a4bd5ec50f3e87837f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 154 zcmX^0Z`VEs1_lcTPId++Mh0%r;L@bx+K!ujCDk2C)P!W`*#l$5|Do@*G1B=^j({72p`$v58 zSxg|Yk$3$y{sQ&fh42w*(tGDl&&-@TGyVPd#|eOESl18|Q1hnaX;1~)_so4WdZSdgYEH?n)dkwNa_h#qBP$SHv|Pt?{3QV;l`b&ZN@d&D(89<|NDZyb zZaC$tYhT32p(CNA9Z`YEVvt5dhd|GJ+jQN7>+mEJ8oCAa6{lvocA?@n%61%GNW>s; zOGg+Hfke*n?2Sg5lsCipkYWLyjiI_Rvd#!$m4;IhZqrPHMh4fT4T4VD^khelt41b+VCAWV_2r= z*|iwPFri`miu%Su-M7m+CNU)tl8m}f`8bu#x>s%Zq-2}rY#gI_Bo%zj_ER@P(gg{6 zqGJY6*`H^B;#9j*>FfQ;Zsv5Z#XP&&cIs8rw{}%2iO zfmqq}cLTKqv|M0NVuc&U0$0>wlXZ(}PDx#shXG+nb}XlOZ6wTN_@?zSZ&rh;YRGDG z1>#1fQM2qdM@~N`XFDZhF~l`dxcWrMU7@8Q3XNaF`1(Mv{ES3?B3@LQ(2K`tGm2^x zNm`voG2BEKtsdh$dcP4FLLblDK`xbNn8S$htzj4{HzP`0qGU}j`dOU}Z$V#p>=^wQ zX(EAB2}1N!0PbLbz!>i09zBxeFOrtjmzx+QmEqhWdW#F;lUY?+`il0x@W6C_eBucA zKPzIOTmACyPZOiXL!^(9$OSy@&I*bkEzs7Mqo=;wcOkarqw+?WLB$$AON zfYMB$&N3E|B|eHdEaEvy_0zwEWp+8k$QO7?Yn~KeVTBc56WfE(KOPYcs~Xb_pk41 diff --git a/src/ReallySimpleSubscriber.class b/src/ReallySimpleSubscriber.class deleted file mode 100644 index 0764dc0a4c19bfb50394ba6960b65a0daf977c71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 800 zcmZuv+iuf95IvhFaq1dM(&hr?vZY*-w$!gkL45!TQ7NK`RFQbx#M^eO^+om?l+S{P zR04?);G+;@J0g_i!LvK-IcLwD*!TD}Plw8nv>c}6WD={fj4hNI z?p%q_!qp!q6G4meVIOL1@(Z^xwOi-N8cP(8MaZ==VnJ*h167 z_6_~RX=0@BpoKO`4O7F=EWj#sKM>LoUJAc&;Vwh_f7;in(w>ZK*kL$+C$$a_`3V<3 zCk(mA1y6DVdGgmmE&{Kp$%QNF@h{3;avL2y$jqr{yGITX{v7w_q3KH+>a)b0u2oQBYi`%%zplTG_vb{WbsXP^{*MCETLDQxxDf zHYuZlqE0abpQ223K>HgSKhXKqxOa{F2QxgJ;qeU57Ib!AR;9sPIc2MW%_)fh2RI~B Ka-Qf)IQj#I488~e diff --git a/src/SimpleSubscriber.class b/src/SimpleSubscriber.class deleted file mode 100644 index 0525bade573c3404a9af6708c16877c257a96388..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 775 zcmZuv%Wl&^6g`tBaq1e{q)k)a?hBH()Ju?pSb&766j3BskyuXRX*-oYw(K#ep9PCl z0*MdcqY!uOh|q+E@63H2pL_27`u+VUfS2$rR2bHL86~0c^HDZVW?kuEbbds57jb%*q(*ucVUtHN#T3H)N>3jRRq02`dgPG#FL~Qi%_FM3`rM6bgpc zARhB@$Wv+jX|Spr|?Xes8#pb+j#P++yxuXIexK zHqjxHajqHKWwVUEkJPEDU+}1J;T}V09`;Qx!$71BJYab7UW8$MPbHU6ynN1cvskeJfM7 zoJ!_JanCM!0+B|u*eJQOXuAy-i!k!NN-i3&rB5r0#9mXJB&U=4TKQZF(@$7p;&ia>p<~@5koWtfw+Mn`UM7a(y_Oj z?DptuI&(%s+wP3kY-P^%{w<{@I&-p!)KWdfB9Z77+?2(u%L~sdLbX*pQb#y2R z2Cib9x(OgKYPLGd>vt7%pxdO=^s?Byh8^HoHIur*Igh9SbFlMyg zU=&H-1jcZojrWusnyN^D#qit_E^2t$!3z7iD4AnEPO??o#! Date: Mon, 2 Mar 2020 22:11:29 +0200 Subject: [PATCH 42/78] unnecessary files --- src/.classpath | 6 ------ src/.project | 17 ----------------- 2 files changed, 23 deletions(-) delete mode 100644 src/.classpath delete mode 100644 src/.project diff --git a/src/.classpath b/src/.classpath deleted file mode 100644 index 3f3893a..0000000 --- a/src/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/.project b/src/.project deleted file mode 100644 index 0c67e86..0000000 --- a/src/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Software Assignment Team 15 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - From c467b6d817c6fb652f8a33f5f90245b187371dcb Mon Sep 17 00:00:00 2001 From: mohamed magdy <36678529+devmagdyy@users.noreply.github.com> Date: Mon, 2 Mar 2020 22:34:56 +0200 Subject: [PATCH 43/78] MulitiplicationSeries-20160219 I'm added my task and call it in main --- .idea/.gitignore | 2 ++ .idea/.name | 1 + .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ GitAssignmentObserver.iml | 12 ++++++++++++ src/Main.java | 1 + src/MultiplicationSeries.java | 17 +++++++++++++++++ 8 files changed, 53 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 GitAssignmentObserver.iml create mode 100644 src/MultiplicationSeries.java diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e7e9d11 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..477e576 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +GitAssignmentObserver \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ba93b15 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3dd0b66 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/GitAssignmentObserver.iml b/GitAssignmentObserver.iml new file mode 100644 index 0000000..26db12c --- /dev/null +++ b/GitAssignmentObserver.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Main.java b/src/Main.java index 9b8c2b0..56e3f57 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,6 +4,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + new MultiplicationSeries(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); diff --git a/src/MultiplicationSeries.java b/src/MultiplicationSeries.java new file mode 100644 index 0000000..01e5ace --- /dev/null +++ b/src/MultiplicationSeries.java @@ -0,0 +1,17 @@ +public class MultiplicationSeries implements ISubscriber { + + public int m(String n) { + int x = Integer.parseInt(n); + int result = 1; + for (int i = 1; i <= x; i++) { + result = result * i; + } + return result; + } + + @Override + public void notifySubscriber(String input) { + System.out.print("Hello,I am a multiplication series and I am notified with" + input); + System.out.print("and my result is : " + m(input)); + } +} \ No newline at end of file From d36757ba0371aa0cb9f0d06dbdbdeebaf5b13693 Mon Sep 17 00:00:00 2001 From: MostafaAshrafMahmoud <36164425+MostafaAshrafMahmoud@users.noreply.github.com> Date: Mon, 2 Mar 2020 23:28:54 +0200 Subject: [PATCH 44/78] 20170285 Adding class SphereArea --- src/Main.java | 1 + src/SphereArea.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/SphereArea.java diff --git a/src/Main.java b/src/Main.java index 967585b..8106995 100644 --- a/src/Main.java +++ b/src/Main.java @@ -12,6 +12,7 @@ public class Main { new CircleArea(), new CircleVolume(), new TwoPowerN(), + new SphereArea(), }; public static void main(String[] args) { Topic mathTopic = new Topic(); diff --git a/src/SphereArea.java b/src/SphereArea.java new file mode 100644 index 0000000..46d638f --- /dev/null +++ b/src/SphereArea.java @@ -0,0 +1,16 @@ + +public class SphereArea implements ISubscriber{ + @Override + public void notifySubscriber(String input) { + + + double radius = Integer.parseInt(input); + double Area = 4*(Math.PI)*Math.pow(radius, 2); + System.out.println("The Area of Sphere = " + Area +" square meters" ); + + + } + + } + + From bc391e3b60585135aa2842aeb489831f4ae7628b Mon Sep 17 00:00:00 2001 From: Megadardery Date: Mon, 2 Mar 2020 23:42:27 +0200 Subject: [PATCH 45/78] removed unnecessary files --- .idea/.name | 1 - .idea/misc.xml | 6 ---- .idea/modules.xml | 8 ------ .idea/vcs.xml | 6 ---- .idea/workspace.xml | 58 --------------------------------------- GitAssignmentObserver.iml | 12 -------- 6 files changed, 91 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml delete mode 100644 GitAssignmentObserver.iml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 477e576..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -GitAssignmentObserver \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index ba93b15..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 3dd0b66..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 6b1befe..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - 1583076785152 - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GitAssignmentObserver.iml b/GitAssignmentObserver.iml deleted file mode 100644 index 26db12c..0000000 --- a/GitAssignmentObserver.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file From 63194c4edc66fa40b2d6b4f0250d8763be8e35c4 Mon Sep 17 00:00:00 2001 From: mohamed magdy <36678529+devmagdyy@users.noreply.github.com> Date: Tue, 3 Mar 2020 01:09:33 +0200 Subject: [PATCH 46/78] MultiplicationSeries-20160219 i am added my task and called it in main. --- .idea/.gitignore | 2 ++ .idea/.name | 1 + .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ src/ISubscriber.java | 2 +- src/Main.java | 3 ++- src/Multiplicationseriess.java | 7 ++++--- src/Topic.java | 2 +- 9 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e7e9d11 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..477e576 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +GitAssignmentObserver \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ba93b15 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3dd0b66 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/ISubscriber.java b/src/ISubscriber.java index 7e3d582..d3a605c 100644 --- a/src/ISubscriber.java +++ b/src/ISubscriber.java @@ -1,4 +1,4 @@ public interface ISubscriber { - public abstract void notifySubscriber(int input); + public abstract void notifySubscriber(String input); } diff --git a/src/Main.java b/src/Main.java index f880665..1283e19 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,6 +4,7 @@ public class Main { private static ISubscriber subscribers [] = { new SimpleSubscriber(), new ReallySimpleSubscriber(), + new Multiplicationseriess(), }; public static void main(String[] args) { @@ -12,7 +13,7 @@ public static void main(String[] args) { mathTopic.addSubscriber(sub); } Scanner sc = new Scanner(System.in); - int input = sc.nextInt(); + String input = sc.next(); mathTopic.dispatchEvent(input); } } diff --git a/src/Multiplicationseriess.java b/src/Multiplicationseriess.java index 6e131e3..e401bae 100644 --- a/src/Multiplicationseriess.java +++ b/src/Multiplicationseriess.java @@ -1,13 +1,14 @@ public class Multiplicationseriess implements ISubscriber { - public int m(int n){ + public int m(String n){ int result = 1; - for(int i=0; i<=n; i++){ + int x = Integer.parseInt(n); + for(int i=0; i<=x; i++){ result = result*i; } return result; } @Override - public void notifySubscriber(int input) { + public void notifySubscriber(String input) { System.out.println("Hello, I am really a simple subscriber and I am notified with " + input); System.out.println("and my result is : " + m(input)); } diff --git a/src/Topic.java b/src/Topic.java index c147e76..8fa2e2e 100644 --- a/src/Topic.java +++ b/src/Topic.java @@ -17,7 +17,7 @@ public List getSubscribers() { return subscribers; } - public void dispatchEvent(int input) { + public void dispatchEvent(String input) { for (ISubscriber sub : this.getSubscribers()) { sub.notifySubscriber(input); } From 734ce1c16edc9c4e92cb2661e7481bcd0d4afd59 Mon Sep 17 00:00:00 2001 From: Megadardery Date: Tue, 3 Mar 2020 20:03:25 +0200 Subject: [PATCH 47/78] deleting unnecessary files --- .idea/.gitignore | 2 -- .idea/.name | 1 - .idea/misc.xml | 6 ------ .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ GitAssignmentObserver.iml | 12 ------------ 6 files changed, 35 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/.name delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 GitAssignmentObserver.iml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index e7e9d11..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Default ignored files -/workspace.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 477e576..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -GitAssignmentObserver \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index ba93b15..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 3dd0b66..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/GitAssignmentObserver.iml b/GitAssignmentObserver.iml deleted file mode 100644 index 26db12c..0000000 --- a/GitAssignmentObserver.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file From ad8d2b8375e14bf4167a205319bd5d2586992579 Mon Sep 17 00:00:00 2001 From: Megadardery Date: Tue, 3 Mar 2020 20:05:14 +0200 Subject: [PATCH 48/78] removing IDE files --- .idea/.gitignore | 2 -- .idea/.name | 1 - .idea/misc.xml | 6 ------ .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ 5 files changed, 23 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/.name delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index e7e9d11..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Default ignored files -/workspace.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 477e576..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -GitAssignmentObserver \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index ba93b15..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 3dd0b66..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 36b05b3c9092a726bcb8e12302ca220b2e2ebd0e Mon Sep 17 00:00:00 2001 From: mohamed magdy <36678529+devmagdyy@users.noreply.github.com> Date: Tue, 3 Mar 2020 20:31:25 +0200 Subject: [PATCH 49/78] multiplicationSeries-20160219 i am edit my code . --- .idea/workspace.xml | 47 ++++++++++++++++++++++++++++++++++ src/Multiplicationseriess.java | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..b63905e --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + 1583190009818 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Multiplicationseriess.java b/src/Multiplicationseriess.java index e401bae..9714ad0 100644 --- a/src/Multiplicationseriess.java +++ b/src/Multiplicationseriess.java @@ -2,7 +2,7 @@ public class Multiplicationseriess implements ISubscriber { public int m(String n){ int result = 1; int x = Integer.parseInt(n); - for(int i=0; i<=x; i++){ + for(int i=1; i<=x; i++){ result = result*i; } return result; From 0f5a4c6c49972c0dcdd6732fb9ba7df280d93066 Mon Sep 17 00:00:00 2001 From: Mina Botros <36329091+Mina1998@users.noreply.github.com> Date: Tue, 3 Mar 2020 20:56:52 +0200 Subject: [PATCH 50/78] Circle Volume Bonus --- src/CircleVolume.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/CircleVolume.java b/src/CircleVolume.java index a29073c..4c2269f 100644 --- a/src/CircleVolume.java +++ b/src/CircleVolume.java @@ -1,11 +1,17 @@ +public class CircleVolume extends DoubleSubscriber { + @Override + public void preProcess(int input) throws Exception { + System.out.print("Hello, I'm CircleVolume, and I'm notified with: " + input + " as radius. "); + if (input < 0) throw new Exception("Negative radius is invalid!"); + } -public class CircleVolume implements ISubscriber { + public double doCalculation(int input) { + return (4.0 / 3.0) * Math.PI * Math.pow(input, 3); + } - @Override - public void notifySubscriber(String input) { - int radius = Integer.parseInt(input); - double CircleVolume = (4.0/3.0) * Math.PI * Math.pow(radius, 3); - System.out.println("The Volume of the Circle is : " + CircleVolume); - } + @Override + public void printAnswer(double output) { + System.out.println("Circle Volume is: " + output); + } } From d3d7e7d6369e6c216a3d86202db086a8e762017b Mon Sep 17 00:00:00 2001 From: mohamed magdy <36678529+devmagdyy@users.noreply.github.com> Date: Tue, 3 Mar 2020 20:58:04 +0200 Subject: [PATCH 51/78] Update workspace.xml --- .idea/workspace.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 7c8fb01..8cf1340 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,17 +2,17 @@ - - - - - - - - + + + + + + + +