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/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..ad36d52
--- /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..3000664
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1583172115957
+
+
+ 1583172115957
+
+
+
+
+
+
+
+
+
\ 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/LucasSeries.java b/src/LucasSeries.java
new file mode 100644
index 0000000..b26a657
--- /dev/null
+++ b/src/LucasSeries.java
@@ -0,0 +1,20 @@
+public class LucasSeries implements ISubscriber {
+ @Override
+ public void notifySubscriber(String input) {
+ try {
+ int LucasIndex = Integer.parseInt(input);
+ System.out.println("Lucas Number is: " + Lucas(LucasIndex));
+ } catch (Exception e) {
+ System.out.println("Error: " + e.getMessage());
+ }
+ }
+
+ int Lucas(int idx) throws Exception {
+ if (idx <= 0) throw new Exception("Error: Lucas applied only for positive numbers.");
+ return Lucas(idx, 1, 2); // Lucas series 2 1 3 4 7 11 18 29
+ }
+
+ private int Lucas(int idx, int value, int previous) {
+ return (idx == 1 ? previous : Lucas(idx - 1, previous + value, value));
+ }
+}
diff --git a/src/Main.java b/src/Main.java
index 9b8c2b0..3349cb7 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -2,8 +2,8 @@
public class Main {
private static ISubscriber subscribers [] = {
- new SimpleSubscriber(),
- new ReallySimpleSubscriber(),
+ new SphereArea(), new LucasSeries() , new SphereCircumference()
+
};
public static void main(String[] args) {
Topic mathTopic = new Topic();
diff --git a/src/ReallySimpleSubscriber.java b/src/ReallySimpleSubscriber.java
deleted file mode 100644
index fb1114a..0000000
--- a/src/ReallySimpleSubscriber.java
+++ /dev/null
@@ -1,8 +0,0 @@
-
-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/src/SimpleSubscriber.java b/src/SimpleSubscriber.java
deleted file mode 100644
index 5b0e4aa..0000000
--- a/src/SimpleSubscriber.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-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/src/SphereArea.java b/src/SphereArea.java
new file mode 100644
index 0000000..df48b27
--- /dev/null
+++ b/src/SphereArea.java
@@ -0,0 +1,13 @@
+public class SphereArea implements ISubscriber {
+ static float pi = 3.14159f;
+ @Override
+ public void notifySubscriber(String input) {
+
+ double Radius = Double.valueOf(input);
+ System.out.println( "Sphere Area = "+Calculate_Area(Radius));
+ }
+ double Calculate_Area(double radius){
+ return (4 * pi * radius * radius);
+ }
+
+ }
diff --git a/src/SphereCircumference.java b/src/SphereCircumference.java
new file mode 100644
index 0000000..22389f2
--- /dev/null
+++ b/src/SphereCircumference.java
@@ -0,0 +1,18 @@
+public class SphereCircumference implements ISubscriber{
+ @Override
+ public void notifySubscriber(String input)
+ {
+ try
+ {
+ double radius = Double.parseDouble(input);
+
+ double circumference = (2 * Math.PI * radius);
+
+ System.out.println("Sphere Circumference = " + circumference);
+ }
+ catch (Exception e)
+ {
+ System.out.println("Exception: " + e);
+ }
+ }
+}
\ No newline at end of file