Skip to content
Open

Aya #108

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6083d9d
init commit for fork
ahmeddrawy Feb 28, 2020
ef91029
adding circle area class andd its object in main
ahmeddrawy Feb 28, 2020
e343a77
removed example classess simpleSubscriber and ReallySimpleSubscriber.…
fares09 Feb 28, 2020
c6a5993
Adding CircleCircumference()
ahmed-focus Feb 28, 2020
9f83e94
adding CircleCircumference()
ahmed-focus Feb 28, 2020
4f865c5
m
ahmed-focus Feb 28, 2020
f08a468
Add Lucas Series Class that implement Function
NaglaEssam12 Feb 29, 2020
1ec0222
Add object of LucasSeriesSub to List of Subscriber
NaglaEssam12 Feb 29, 2020
efa6edb
added a description to println in notifySubscriber function in Sphere…
fares09 Mar 1, 2020
367475b
Create MultiplicationSeries.java
ayaamr11 Mar 1, 2020
a54e848
modifications
ayaamr11 Mar 1, 2020
a4eb213
Update MultiplicationSeries.java
ayaamr11 Mar 1, 2020
9cc4442
Update MultiplicationSeries.java
ayaamr11 Mar 1, 2020
8b8d830
SphereVolume class added with overriding NotifySubscriber method
mina5alaf Mar 2, 2020
cddfc10
Class SphereVolume added with overriding the method "NotifySubscriber"
mina5alaf Mar 2, 2020
b744155
Added class SphereVolume with overriding Notifysubscriber
mina5alaf Mar 2, 2020
d74ac4a
Added class SphereVolume
mina5alaf Mar 2, 2020
41d8143
added power function
youssefadel92 Mar 2, 2020
d3438ba
20170313 / Add Lucas Series Class that Implement
NaglaEssam12 Mar 2, 2020
4b8fd04
20170313/ Add object of LucasSeriesSub Class to
NaglaEssam12 Mar 2, 2020
101ca2b
20170313 / delete ReallySimpleSubscriber Class
NaglaEssam12 Mar 2, 2020
f4c61a2
20170313 / delete Simple Subscriber Class
NaglaEssam12 Mar 2, 2020
f94373c
Merge pull request #1 from ahmeddrawy/fares_20170191
ahmeddrawy Mar 3, 2020
9773f48
Merge branch 'master' into fawzy
ahmeddrawy Mar 3, 2020
5959efc
Merge pull request #2 from ahmeddrawy/fawzy
ahmeddrawy Mar 3, 2020
784f69f
Merge branch 'master' into Naglaa---20170313
ahmeddrawy Mar 3, 2020
bf9cdbc
Merge pull request #7 from ahmeddrawy/Naglaa---20170313
ahmeddrawy Mar 3, 2020
40e3933
Merge branch 'master' into minakhalaf-20170308
ahmeddrawy Mar 3, 2020
fbccacc
Merge pull request #5 from mina5alaf/minakhalaf-20170308
ahmeddrawy Mar 3, 2020
11b59c2
Merge branch 'master' into youssef(20170345)
ahmeddrawy Mar 3, 2020
48416bf
Merge pull request #6 from ahmeddrawy/youssef(20170345)
ahmeddrawy Mar 3, 2020
3cf6b17
Merge branch 'master' into Hanafy
ahmeddrawy Mar 3, 2020
ad8b431
Merge pull request #8 from ahmeddrawy/Hanafy
ahmeddrawy Mar 3, 2020
d29494c
Merge branch 'master' into aya-
ahmeddrawy Mar 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions init.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
init repo

10 changes: 10 additions & 0 deletions src/CircleAreaObserver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public class CircleAreaObserver implements ISubscriber {
@Override
public void notifySubscriber(String input) {
System.out.println("Circle of radius = " + " has Area = " + areaOfCircle(Integer.parseInt(input)));
}
private double areaOfCircle(int r){
return Math.PI *r *2;

}
}
9 changes: 9 additions & 0 deletions src/CircleCircumference.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public class CircleCircumference implements ISubscriber {

public void notifySubscriber(String input) {
double radius=Double.parseDouble(input);
//System.out.println("Hello, I am really a simple subscriber and I am notified with " + input);
double circumference= Math.PI * 2*radius;
System.out.println( "The circumference of this circle is: "+circumference) ;
}
}
39 changes: 39 additions & 0 deletions src/LucasSeriesSub.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import java.util.ArrayList;

public class LucasSeriesSub implements ISubscriber {
@Override
public void notifySubscriber(String input) {
int numOfTerms = Integer.parseInt(input);
ArrayList<Integer>lucesResult = new ArrayList<Integer>();
int temp1 = 2 , temp2 = 1;
int j = 0 , temp = 0;
if(numOfTerms == 1)
{
lucesResult.add(temp1);
}
else if (numOfTerms == 2)
{
lucesResult.add(temp1);
lucesResult.add(temp2);
}
else if (numOfTerms > 2)
{
lucesResult.add(temp1);
lucesResult.add(temp2);
for(int i = 2 ; i < numOfTerms ; i++)
{
temp1 = lucesResult.get(j);
temp2 = lucesResult.get(++j);
temp = temp1 + temp2;
lucesResult.add(temp);
}
}
else
{
System.out.println("Not invalid Input");
System.exit(0);
}
System.out.println("The Series is : " + lucesResult);
}

}
9 changes: 7 additions & 2 deletions src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

public class Main {
private static ISubscriber subscribers [] = {
new SimpleSubscriber(),
new ReallySimpleSubscriber(),
new MultiplicationSeries(),
new CircleAreaObserver(),
new Power(),
new SphereVolume(),
new CircleCircumference(),
new SphereAreaSub(),
new LucasSeriesSub()
};
public static void main(String[] args) {
Topic mathTopic = new Topic();
Expand Down
17 changes: 17 additions & 0 deletions src/MultiplicationSeries.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class MultiplicationSeries implements ISubscriber {
public void notifySubscriber(String input){
// TODO Auto-generated method stub

int n =Integer.parseInt(input);
int result = n;


while(n>1) {
n-=1;
result =result *n;


}
System.out.println("the multiplication series of " + input +" is " + result );
}
}
8 changes: 8 additions & 0 deletions src/Power.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import java.math.*;
public class Power implements ISubscriber {
@Override
public void notifySubscriber(String input) {
// TODO Auto-generated method stub
System.out.println("2 Power "+input+": "+Math.pow(2, Double.parseDouble(input)));
}
}
8 changes: 0 additions & 8 deletions src/ReallySimpleSubscriber.java

This file was deleted.

10 changes: 0 additions & 10 deletions src/SimpleSubscriber.java

This file was deleted.

13 changes: 13 additions & 0 deletions src/SphereAreaSub.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

public class SphereAreaSub implements ISubscriber{


public void notifySubscriber(String input) { // input will be a single integer for all functions.
int r = Integer.parseInt(input);// radius
double area;
area = 4 * 3.14 * (r*r); // 4Pi*r^2.
System.out.println("Sphere Area with r = "+ r +": " + area);
}


}
11 changes: 11 additions & 0 deletions src/SphereVolume.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

public class SphereVolume implements ISubscriber{
public void notifySubscriber(String input) {
Float Rad;
double Res;
Rad = Float.parseFloat(input);
Res=(4/3)*(3.14)*(Rad*Rad*Rad);
System.out.println("Sphere Volume =" + Res);
}

}