diff --git a/.gitignore b/.gitignore
index 539bdba..17245e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,4 +53,12 @@ local.properties
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
-.worksheet
\ No newline at end of file
+.worksheet
+
+#ignored directories and files
+*/.idea/*
+.idea/*
+*/out/*
+out/*
+.classpath
+.project
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..34f247c
--- /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..81c2cd4
--- /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..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..daa44ae
--- /dev/null
+++ b/README.md
@@ -0,0 +1,30 @@
+# git_assignment_initial
+
+
+import java.util.Arrays;
+import java.util.Scanner;
+
+/**
+ *
+ * @author ahmed farag
+ */
+public class CircleCircumference implements ISubscriber {
+
+ void CalculateCircleCircumference (float radius)
+ {
+ radius=0;
+ Scanner inbut=new Scanner(System.in);
+ System.out.print("Enter Radius of Circle : ");
+ radius=inbut.nextFloat();
+ double circlecircumference=0;
+ circlecircumference=2*(3.14)*radius;
+ System.out.print("Circle Cumference Equal = "+circlecircumference);
+ }
+ @Override
+ public void notifySubscriber(float input)
+ {
+ System.out.println("The result of Lucas Series is " + CalculateCircleCircumference (input));
+ }
+
+
+}
diff --git a/git_assignment_20170362/build.xml b/git_assignment_20170362/build.xml
new file mode 100644
index 0000000..54aee63
--- /dev/null
+++ b/git_assignment_20170362/build.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project git_assignment_20170362.
+
+
+
diff --git a/git_assignment_20170362/build/classes/git_assignment_20170362/Git_assignment_20170362.rs b/git_assignment_20170362/build/classes/git_assignment_20170362/Git_assignment_20170362.rs
new file mode 100644
index 0000000..da7815b
--- /dev/null
+++ b/git_assignment_20170362/build/classes/git_assignment_20170362/Git_assignment_20170362.rs
@@ -0,0 +1 @@
+git_assignment_20170362.Main
diff --git a/git_assignment_20170362/build/classes/git_assignment_20170362/ISubscriber.class b/git_assignment_20170362/build/classes/git_assignment_20170362/ISubscriber.class
new file mode 100644
index 0000000..66d6b6e
Binary files /dev/null and b/git_assignment_20170362/build/classes/git_assignment_20170362/ISubscriber.class differ
diff --git a/git_assignment_20170362/build/classes/git_assignment_20170362/Main.class b/git_assignment_20170362/build/classes/git_assignment_20170362/Main.class
new file mode 100644
index 0000000..03542fb
Binary files /dev/null and b/git_assignment_20170362/build/classes/git_assignment_20170362/Main.class differ
diff --git a/git_assignment_20170362/build/classes/git_assignment_20170362/ReallySimpleSubscriber.class b/git_assignment_20170362/build/classes/git_assignment_20170362/ReallySimpleSubscriber.class
new file mode 100644
index 0000000..aece1fc
Binary files /dev/null and b/git_assignment_20170362/build/classes/git_assignment_20170362/ReallySimpleSubscriber.class differ
diff --git a/git_assignment_20170362/build/classes/git_assignment_20170362/SimpleSubscriber.class b/git_assignment_20170362/build/classes/git_assignment_20170362/SimpleSubscriber.class
new file mode 100644
index 0000000..758c4d5
Binary files /dev/null and b/git_assignment_20170362/build/classes/git_assignment_20170362/SimpleSubscriber.class differ
diff --git a/git_assignment_20170362/build/classes/git_assignment_20170362/SphereArea.class b/git_assignment_20170362/build/classes/git_assignment_20170362/SphereArea.class
new file mode 100644
index 0000000..2ae6ad3
Binary files /dev/null and b/git_assignment_20170362/build/classes/git_assignment_20170362/SphereArea.class differ
diff --git a/git_assignment_20170362/build/classes/git_assignment_20170362/Topic.class b/git_assignment_20170362/build/classes/git_assignment_20170362/Topic.class
new file mode 100644
index 0000000..1ca3824
Binary files /dev/null and b/git_assignment_20170362/build/classes/git_assignment_20170362/Topic.class differ
diff --git a/git_assignment_20170362/manifest.mf b/git_assignment_20170362/manifest.mf
new file mode 100644
index 0000000..1574df4
--- /dev/null
+++ b/git_assignment_20170362/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/git_assignment_20170362/nbproject/build-impl.xml b/git_assignment_20170362/nbproject/build-impl.xml
new file mode 100644
index 0000000..af4670f
--- /dev/null
+++ b/git_assignment_20170362/nbproject/build-impl.xml
@@ -0,0 +1,1420 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/git_assignment_20170362/nbproject/genfiles.properties b/git_assignment_20170362/nbproject/genfiles.properties
new file mode 100644
index 0000000..d91b398
--- /dev/null
+++ b/git_assignment_20170362/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=ec6531ee
+build.xml.script.CRC32=0b61d11f
+build.xml.stylesheet.CRC32=8064a381@1.80.1.48
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=ec6531ee
+nbproject/build-impl.xml.script.CRC32=4f59a6ff
+nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
diff --git a/git_assignment_20170362/nbproject/private/private.properties b/git_assignment_20170362/nbproject/private/private.properties
new file mode 100644
index 0000000..ece2773
--- /dev/null
+++ b/git_assignment_20170362/nbproject/private/private.properties
@@ -0,0 +1,2 @@
+compile.on.save=true
+user.properties.file=C:\\Users\\ALI FCI\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
diff --git a/git_assignment_20170362/nbproject/project.properties b/git_assignment_20170362/nbproject/project.properties
new file mode 100644
index 0000000..be4148f
--- /dev/null
+++ b/git_assignment_20170362/nbproject/project.properties
@@ -0,0 +1,74 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processor.options=
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/git_assignment_20170362.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+excludes=
+includes=**
+jar.compress=false
+javac.classpath=
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.external.vm=true
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.8
+javac.target=1.8
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=git_assignment_20170362.Main
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/git_assignment_20170362/nbproject/project.xml b/git_assignment_20170362/nbproject/project.xml
new file mode 100644
index 0000000..4c373ad
--- /dev/null
+++ b/git_assignment_20170362/nbproject/project.xml
@@ -0,0 +1,15 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ git_assignment_20170362
+
+
+
+
+
+
+
+
+
diff --git a/git_assignment_20170362/src/git_assignment_20170362/ISubscriber.java b/git_assignment_20170362/src/git_assignment_20170362/ISubscriber.java
new file mode 100644
index 0000000..cebbe67
--- /dev/null
+++ b/git_assignment_20170362/src/git_assignment_20170362/ISubscriber.java
@@ -0,0 +1,11 @@
+/**
+ *
+ * @author ALI FCI
+ */
+package git_assignment_20170362;
+
+public interface ISubscriber {
+ public abstract void notifySubscriber(String input);
+
+
+}
diff --git a/git_assignment_20170362/src/git_assignment_20170362/Main.java b/git_assignment_20170362/src/git_assignment_20170362/Main.java
new file mode 100644
index 0000000..37a1380
--- /dev/null
+++ b/git_assignment_20170362/src/git_assignment_20170362/Main.java
@@ -0,0 +1,30 @@
+/*
+ * 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 git_assignment_20170362;
+
+import java.util.Scanner;
+
+public class Main {
+
+ private static ISubscriber subscribers [] = {
+ new SimpleSubscriber(),
+ new ReallySimpleSubscriber(),
+ new SphereArea(),
+ };
+ public static void main(String[] args) {
+ Topic mathTopic = new Topic();
+ for (ISubscriber sub : subscribers) {
+ mathTopic.addSubscriber(sub);
+ }
+
+ System.out.println("Enter the raduis of Sphere : " );
+
+ Scanner sc = new Scanner(System.in);
+ String input = sc.next();
+ mathTopic.dispatchEvent(input);
+ }
+
+}
diff --git a/src/ReallySimpleSubscriber.java b/git_assignment_20170362/src/git_assignment_20170362/ReallySimpleSubscriber.java
similarity index 83%
rename from src/ReallySimpleSubscriber.java
rename to git_assignment_20170362/src/git_assignment_20170362/ReallySimpleSubscriber.java
index fb1114a..c7b534a 100644
--- a/src/ReallySimpleSubscriber.java
+++ b/git_assignment_20170362/src/git_assignment_20170362/ReallySimpleSubscriber.java
@@ -1,8 +1,12 @@
-
-public class ReallySimpleSubscriber implements ISubscriber {
- @Override
- public void notifySubscriber(String input) {
- // TODO Auto-generated method stub
- System.out.println("Hello, I am really a simple subscriber and I am notified with " + input);
- }
-}
+package git_assignment_20170362;
+
+public class ReallySimpleSubscriber implements ISubscriber {
+
+ @Override
+ public void notifySubscriber(String 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/git_assignment_20170362/src/git_assignment_20170362/SimpleSubscriber.java b/git_assignment_20170362/src/git_assignment_20170362/SimpleSubscriber.java
new file mode 100644
index 0000000..9fb9c19
--- /dev/null
+++ b/git_assignment_20170362/src/git_assignment_20170362/SimpleSubscriber.java
@@ -0,0 +1,12 @@
+package git_assignment_20170362;
+
+public class SimpleSubscriber implements ISubscriber {
+
+ @Override
+ public void notifySubscriber(String input) {
+ // TODO Auto-generated method stub
+
+ System.out.println("Hello, I am a simple subscriber and I am notified with " + input);
+ }
+
+}
diff --git a/git_assignment_20170362/src/git_assignment_20170362/SphereArea.java b/git_assignment_20170362/src/git_assignment_20170362/SphereArea.java
new file mode 100644
index 0000000..324ec3d
--- /dev/null
+++ b/git_assignment_20170362/src/git_assignment_20170362/SphereArea.java
@@ -0,0 +1,22 @@
+package git_assignment_20170362;
+
+public class SphereArea implements ISubscriber{
+
+ static double area;
+
+ public static void calcSphereArea(int raduis)
+ {
+ area = 4* Math.PI * Math.pow(raduis, 2);
+ area = Double.parseDouble(String.format("%.2f", area));
+ System.out.println("Aree of the Sphere = " + area);
+
+ }
+
+ @Override
+ public void notifySubscriber(String input) {
+ int raduis = Integer.parseInt(input);
+ calcSphereArea(raduis);
+
+ }
+
+}
diff --git a/git_assignment_20170362/src/git_assignment_20170362/Topic.java b/git_assignment_20170362/src/git_assignment_20170362/Topic.java
new file mode 100644
index 0000000..d49d856
--- /dev/null
+++ b/git_assignment_20170362/src/git_assignment_20170362/Topic.java
@@ -0,0 +1,40 @@
+/*
+ * 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 git_assignment_20170362;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author ALI FCI
+ */
+public class Topic {
+
+ private List subscribers;
+
+ public Topic() {
+ subscribers = new ArrayList();
+ }
+
+ public void addSubscriber(ISubscriber sub) {
+ subscribers.add(sub);
+ }
+
+ public List getSubscribers() {
+ return subscribers;
+ }
+
+ public void dispatchEvent(String input) {
+ for (ISubscriber sub : this.getSubscribers()) {
+ sub.notifySubscriber(input);
+ }
+ }
+
+ void dispatchEvent(double input) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+}
diff --git a/git_assignment_initial.iml b/git_assignment_initial.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/git_assignment_initial.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/git_assignment_initial/ISubscriber.class b/out/production/git_assignment_initial/ISubscriber.class
new file mode 100644
index 0000000..53dfb83
Binary files /dev/null and b/out/production/git_assignment_initial/ISubscriber.class differ
diff --git a/out/production/git_assignment_initial/Main.class b/out/production/git_assignment_initial/Main.class
new file mode 100644
index 0000000..c3b4ebf
Binary files /dev/null and b/out/production/git_assignment_initial/Main.class differ
diff --git a/out/production/git_assignment_initial/SimpleSubscriber.class b/out/production/git_assignment_initial/SimpleSubscriber.class
new file mode 100644
index 0000000..a883467
Binary files /dev/null and b/out/production/git_assignment_initial/SimpleSubscriber.class differ
diff --git a/out/production/git_assignment_initial/SphereCircumference.class b/out/production/git_assignment_initial/SphereCircumference.class
new file mode 100644
index 0000000..745bb12
Binary files /dev/null and b/out/production/git_assignment_initial/SphereCircumference.class differ
diff --git a/out/production/git_assignment_initial/Topic.class b/out/production/git_assignment_initial/Topic.class
new file mode 100644
index 0000000..fee8ed4
Binary files /dev/null and b/out/production/git_assignment_initial/Topic.class differ
diff --git a/src/FibonacciSeries.java b/src/FibonacciSeries.java
new file mode 100644
index 0000000..4e9b391
--- /dev/null
+++ b/src/FibonacciSeries.java
@@ -0,0 +1,16 @@
+public class FibonacciSeries implements ISubscriber
+{
+ public void notifySubscriber(int input)
+ {
+ int result = fib(input);
+ System.out.println("The result of fibonacci series is "+ result);
+ }
+ int fib(int n)
+ {
+ if (n <= 1)
+ return n;
+ return fib(n-1) + fib(n-2);
+ }
+
+
+}
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/LucasSeries.java b/src/LucasSeries.java
new file mode 100644
index 0000000..3ccca39
--- /dev/null
+++ b/src/LucasSeries.java
@@ -0,0 +1,22 @@
+import java.util.Arrays;
+
+public class LucasSeries implements ISubscriber
+{
+ private long mem[] = new long[48];
+ private long lucas_series(int idx)
+ {
+ if(idx == 0)
+ return 2;
+ if(idx == 1)
+ return 1;
+ if(mem[idx] == 0)
+ mem[idx] = lucas_series(idx - 1) + lucas_series(idx - 2);
+ return mem[idx];
+ }
+ @Override
+ public void notifySubscriber(int input)
+ {
+ Arrays.fill(mem,0);
+ System.out.println("The Result of Lucas Series is " + lucas_series(input));
+ }
+}
diff --git a/src/Main.java b/src/Main.java
index 9b8c2b0..326ea80 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -3,7 +3,12 @@
public class Main {
private static ISubscriber subscribers [] = {
new SimpleSubscriber(),
- new ReallySimpleSubscriber(),
+ new SphereCircumference(),
+ new FibonacciSeries(),
+ new LucasSeries(),
+ new TwoPowerN(),
+ new MultiplicationSeries(),
+ new circle_area()
};
public static void main(String[] args) {
Topic mathTopic = new Topic();
@@ -11,7 +16,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/SimpleSubscriber.java b/src/SimpleSubscriber.java
index 5b0e4aa..d3a608c 100644
--- a/src/SimpleSubscriber.java
+++ b/src/SimpleSubscriber.java
@@ -2,7 +2,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
new file mode 100644
index 0000000..c0c5da2
--- /dev/null
+++ b/src/SphereCircumference.java
@@ -0,0 +1,10 @@
+import java.lang.*;
+public class SphereCircumference implements ISubscriber {
+ @Override
+ public void notifySubscriber(int input) {
+ // The circumference of the sphere = 2 * PI * r
+ // the input will be the radius of the circle
+ double circumference = 2 * Math.PI * (double)input;
+ System.out.println("The circumference of the sphere = " + circumference);
+ }
+}
diff --git a/src/Topic.java b/src/Topic.java
index 8fa2e2e..23433a4 100644
--- a/src/Topic.java
+++ b/src/Topic.java
@@ -12,12 +12,16 @@ public Topic() {
public void addSubscriber(ISubscriber sub) {
subscribers.add(sub);
}
+
+ public void removeSubscriber(ISubscriber sub){
+ subscribers.remove(sub);
+ }
public List getSubscribers() {
return subscribers;
}
- public void dispatchEvent(String input) {
+ public void dispatchEvent(int input) {
for (ISubscriber sub : this.getSubscribers()) {
sub.notifySubscriber(input);
}
diff --git a/src/TwoPowerN.java b/src/TwoPowerN.java
new file mode 100644
index 0000000..f7ee208
--- /dev/null
+++ b/src/TwoPowerN.java
@@ -0,0 +1,7 @@
+public class TwoPowerN implements ISubscriber{
+ @Override
+ public void notifySubscriber(int N) {
+ double result = Math.pow(2, N);
+ System.out.println("2 power " + N + " equals: " + result);
+ }
+}
\ No newline at end of file
diff --git a/src/circle_area.java b/src/circle_area.java
new file mode 100644
index 0000000..b5ebdd4
--- /dev/null
+++ b/src/circle_area.java
@@ -0,0 +1,7 @@
+public class CircleArea implements ISubscriber{
+ @Override
+ public void notifySubscriber(double r) {
+ double RSquare = Math.pow(r, 2);
+ System.out.println("Circle area for a radius equals to " + r + " equals: " + ((3.14)*RSquare));
+ }
+}
\ No newline at end of file