Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fc5dda8
Update Main.java
nourelsakhey Feb 29, 2020
9000119
20170320
nourelsakhey Feb 29, 2020
318afb8
Thoria hamdy 20170082 SphereVolume
ThoriaHamdy99 Feb 29, 2020
9c2bf54
Delete SphereVolume.java
nourelsakhey Mar 1, 2020
d664044
Update Main.java
nourelsakhey Mar 1, 2020
60ea656
Delete CircleCircumference.java
nourelsakhey Mar 1, 2020
ea6a32b
Delete SphereVolume.java
nourelsakhey Mar 1, 2020
1f40deb
Update Main.java
nourelsakhey Mar 1, 2020
111804f
Mostafa Mohamed 20140272 SummationSeries
YahiaNabil Mar 1, 2020
e0f1058
Merge branch 'master' into MostafaMohamed20140272SummationSeries
Mostafa2369 Mar 1, 2020
e9e48d6
Merge pull request #1 from nourelsakhey/MostafaMohamed20140272Summati…
Mostafa2369 Mar 1, 2020
3805911
Merge branch '20170320-CircleCircumference'
nourelsakhey Mar 1, 2020
d1562b2
Add files via upload
nourelsakhey Mar 1, 2020
79837a3
Mostafa Mohamed 20140272 SummationSeries
Mostafa2369 Mar 1, 2020
f5fe720
Merge pull request #2 from nourelsakhey/MostafaMohamed20140272Summati…
Mostafa2369 Mar 1, 2020
112f8c4
adding MultiplicationSeries
abdelrahman2099 Mar 1, 2020
de378e8
Circle Area 20150262
moataz1996 Mar 2, 2020
f08e96a
Merge pull request #3 from nourelsakhey/branch20150262
moataz1996 Mar 2, 2020
25dc855
20160168-2PowerN
AmrDodchy Mar 2, 2020
618b7ee
2PowerN Added
AmrDodchy Mar 2, 2020
d61d153
Fibonacci-20160198
Mohamedhusseind Mar 2, 2020
93c8dfc
MultiplicationSeries 20170152
abdelrahman2099 Mar 1, 2020
f3c8405
Circle Area 20150262
moataz1996 Mar 2, 2020
74adee4
Merge pull request #5 from nourelsakhey/20120428/SphereCircumference
nehal2012 Mar 2, 2020
96b1b7c
Merge branch 'master' into 20160168-2PowerN
AmrDodchy Mar 2, 2020
4a17571
Merge pull request #4 from nourelsakhey/20160168-2PowerN
AmrDodchy Mar 2, 2020
c1cdaaa
Implemented update
Mohamedhusseind Mar 2, 2020
c29ccbd
Merge pull request #6 from nourelsakhey/Fibonacci
AmrDodchy Mar 2, 2020
a2f7163
emanayman20170067ballvolume
emanayman657 Mar 2, 2020
0d51a60
new
emanayman657 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 .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions GitAssignmentObserver.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
</component>
</module>
22 changes: 22 additions & 0 deletions src/BallVolume.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
*
* @author Eman Ayman Khalaf 20170067
*/
import java.util.Scanner;

public class BallVolume implements ISubscriber {

public BallVolume(){

}

@Override
public void notifySubscriber(String input) {
int radius= Integer.parseInt(input);
double pie=3.14285714286;
double volume=(4.0/3.0)*pie*(radius*radius*radius); // the volume of ball
System.out.println("Volume of the sphere="+volume);
}

}

12 changes: 12 additions & 0 deletions src/CircleArea.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import java.util.Scanner;

public class CircleArea implements ISubscriber
{
@Override
public void notifySubscriber(String input){
int r = Integer.parseInt(input);
double pi = 3.14, area;
area = pi * r * r;
System.out.println("Area of circle: "+ area);
}
}
27 changes: 27 additions & 0 deletions src/CircleCircumference.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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.
*/


/**
*
* @author Nour-Alhoda Khalid
*/
public class CircleCircumference implements ISubscriber {

public CircleCircumference() {

}

@Override
public void notifySubscriber(String input){
double x= Double.parseDouble(input);
double y=2*3.14*x;
System.out.print("the circumference equals ");
System.out.println(y);
}


}
21 changes: 21 additions & 0 deletions src/Fibonacci.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main;

/*
* 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.
*/

/**
*
* @author m_h
*/
public class Fibonacci implements ISubscriber {
@Override
public void notifySubscriber(long n) {
if ((n == 0) || (n == 1))
System.out.println("Fibonacci of "+ n + " = " + n );
else
System.out.println("Fibonacci of " + n + " = " + Get_Fibonacci(n - 1) + Get_Fibonacci(n - 2));
}
}
19 changes: 18 additions & 1 deletion src/Main.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@

import java.util.Scanner;

public class Main {
private static ISubscriber subscribers [] = {
private static final ISubscriber subscribers [] = {
new SimpleSubscriber(),

new ReallySimpleSubscriber(),

new CircleCircumference(),
new SphereVolume(),
new BallVolume(),
new SummationSeries(),
new MultiplicationSeries(),
new CircleArea(),
new TwoPowerN()






};
public static void main(String[] args) {
Topic mathTopic = new Topic();
Expand All @@ -15,3 +31,4 @@ public static void main(String[] args) {
mathTopic.dispatchEvent(input);
}
}

14 changes: 14 additions & 0 deletions src/MultiplicationSeries.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import java.math.BigDecimal;

public class MultiplicationSeries implements ISubscriber {

@Override
public void notifySubscriber(String input) {
BigDecimal output=new BigDecimal("1");
for (int i = Integer.parseInt(input); i > 0; i--) {
output=output.multiply(BigDecimal.valueOf(i));
}
System.out.println("MultiplicationSeries : "+output);
}

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

int factorial(int t)
{
int mul = 1;

while(t > 0)
{
mul = mul * t;

t--;
}
return mul;
}



@Override
public void notifySubscriber(String input)
{
double y = 0;
int x=Integer.parseInt(input);

SummationSeries mSummationSeries = new SummationSeries();
for(int i = 1; i <= x; i++)
{
y = y + (double)i / (mSummationSeries.factorial(i));
}
System.out.println("Summation Series: "+y);
}

}
15 changes: 15 additions & 0 deletions src/TwoPowerN.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import java.lang.Math;

public class TwoPowerN implements ISubscriber
{

@Override
public void notifySubscriber(String input)
{

double n= Double.parseDouble(input);

System.out.println("2 power " + input + " equals " + Math.pow(2,n));
}

}