From 015e83fbefe31b8b886f13e0183451e3ba45ac55 Mon Sep 17 00:00:00 2001
From: nooratef <36491699+nooratef@users.noreply.github.com>
Date: Mon, 2 Mar 2020 20:17:45 +0200
Subject: [PATCH 1/4] SphereArea
---
.idea/.name | 1 +
.idea/misc.xml | 6 +
.idea/modules.xml | 8 +
.idea/vcs.xml | 6 +
.idea/workspace.xml | 281 ++++++++++++++++++++++++++++++++
GitAssignmentObserver.iml | 12 ++
src/Main.java | 4 +-
src/ReallySimpleSubscriber.java | 8 -
src/SimpleSubscriber.java | 10 --
src/SphereArea.java | 14 ++
10 files changed, 330 insertions(+), 20 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
delete mode 100644 src/ReallySimpleSubscriber.java
delete mode 100644 src/SimpleSubscriber.java
create mode 100644 src/SphereArea.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..cefb937
--- /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..dab0ff2
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,281 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1583172115957
+
+
+ 1583172115957
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GitAssignmentObserver.iml b/GitAssignmentObserver.iml
new file mode 100644
index 0000000..409f5aa
--- /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..797c630 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()
+
};
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..9308b42
--- /dev/null
+++ b/src/SphereArea.java
@@ -0,0 +1,14 @@
+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);
+ }
+
+ }
+}
From 09b61717fb440b93409c8d90ee0c64861fb0d8db Mon Sep 17 00:00:00 2001
From: Belal Hamdy
Date: Mon, 2 Mar 2020 21:06:31 +0200
Subject: [PATCH 2/4] Added Lucas Series 20170077
---
src/LucasSeries.java | 20 ++++++++++++++++++++
src/Main.java | 2 +-
2 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 src/LucasSeries.java
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 797c630..092220d 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -2,7 +2,7 @@
public class Main {
private static ISubscriber subscribers [] = {
- new SphereArea()
+ new SphereArea(), new LucasSeries()
};
public static void main(String[] args) {
From 94151f74f6224bc334c531aeb349e3351475cf54 Mon Sep 17 00:00:00 2001
From: Atef Magdy
Date: Mon, 2 Mar 2020 21:32:31 +0200
Subject: [PATCH 3/4] Added SphereCircumference class
---
.idea/codeStyles/codeStyleConfig.xml | 5 +
.idea/misc.xml | 2 +-
.idea/workspace.xml | 255 ++++-----------------------
GitAssignmentObserver.iml | 2 +-
src/Main.java | 2 +-
src/SphereArea.java | 1 -
src/SphereCircumference.java | 18 ++
7 files changed, 64 insertions(+), 221 deletions(-)
create mode 100644 .idea/codeStyles/codeStyleConfig.xml
create mode 100644 src/SphereCircumference.java
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
index cefb937..ad36d52 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index dab0ff2..b38bcc1 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,61 +1,22 @@
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -67,48 +28,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
+
+
+
+
@@ -125,44 +54,25 @@
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
+
+
+
@@ -178,104 +88,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/GitAssignmentObserver.iml b/GitAssignmentObserver.iml
index 409f5aa..26db12c 100644
--- a/GitAssignmentObserver.iml
+++ b/GitAssignmentObserver.iml
@@ -7,6 +7,6 @@
-
+
\ No newline at end of file
diff --git a/src/Main.java b/src/Main.java
index 092220d..3349cb7 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -2,7 +2,7 @@
public class Main {
private static ISubscriber subscribers [] = {
- new SphereArea(), new LucasSeries()
+ new SphereArea(), new LucasSeries() , new SphereCircumference()
};
public static void main(String[] args) {
diff --git a/src/SphereArea.java b/src/SphereArea.java
index 9308b42..df48b27 100644
--- a/src/SphereArea.java
+++ b/src/SphereArea.java
@@ -11,4 +11,3 @@ public void notifySubscriber(String input) {
}
}
-}
diff --git a/src/SphereCircumference.java b/src/SphereCircumference.java
new file mode 100644
index 0000000..90de133
--- /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
From cbf4eec432c18c30bff526f45b125da69dbbf66c Mon Sep 17 00:00:00 2001
From: Atef Magdy
Date: Mon, 2 Mar 2020 21:57:24 +0200
Subject: [PATCH 4/4] Update SphereCircumference class
---
.idea/workspace.xml | 10 ++++------
src/SphereCircumference.java | 2 +-
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b38bcc1..3000664 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,12 +2,8 @@
-
-
-
-
-
+
@@ -93,7 +89,9 @@
diff --git a/src/SphereCircumference.java b/src/SphereCircumference.java
index 90de133..22389f2 100644
--- a/src/SphereCircumference.java
+++ b/src/SphereCircumference.java
@@ -8,7 +8,7 @@ public void notifySubscriber(String input)
double circumference = (2 * Math.PI * radius);
- System.out.println("Sphere Circumference : " + circumference);
+ System.out.println("Sphere Circumference = " + circumference);
}
catch (Exception e)
{