BAEL-2797 new domain "math"created, sections moved

This commit is contained in:
anilkivilcim.eray
2019-04-03 00:37:24 +03:00
parent 0a8d9fe187
commit 94bf17615c
184 changed files with 717 additions and 218 deletions

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.primechecker;
package com.baeldung.math.primechecker;
import java.math.BigInteger;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.primechecker;
package com.baeldung.math.primechecker;
import java.util.stream.IntStream;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.primechecker;
package com.baeldung.math.primechecker;
import java.util.stream.IntStream;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.primechecker;
package com.baeldung.math.primechecker;
public interface PrimeChecker <T> {

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.primechecker;
package com.baeldung.math.primechecker;
import org.apache.commons.math3.primes.Primes;

View File

@@ -1,21 +0,0 @@
package com.baeldung.percentage;
import java.util.Scanner;
public class PercentageCalculator {
public double calculatePercentage(double obtained,double total){
return obtained*100/total;
}
public static void main(String[] args) {
PercentageCalculator pc = new PercentageCalculator();
Scanner in = new Scanner(System.in);
System.out.println("Enter obtained marks:");
double obtained = in.nextDouble();
System.out.println("Enter total marks:");
double total =in.nextDouble();
System.out.println("Percentage obtained :"+pc.calculatePercentage(obtained,total));
}
}

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.primechecker;
package com.baeldung.math.primechecker;
import org.junit.Test;

View File

@@ -1,33 +0,0 @@
package com.baeldung.percentage;
import org.junit.Assert;
import org.junit.Test;
public class PercentageCalculatorUnitTest {
private PercentageCalculator pc = new PercentageCalculator();
@Test
public void whenPass2Integers_thenShouldCalculatePercentage(){
Assert.assertEquals("Result not as expected",
50.0,pc.calculatePercentage(50,100),0.1);
}
@Test
public void whenPassObtainedMarksAsDouble_thenShouldCalculatePercentage(){
Assert.assertEquals("Result not as expected",5.05,
pc.calculatePercentage(50.5,1000),0.1);
}
@Test
public void whenPassTotalMarksAsDouble_thenShouldCalculatePercentage(){
Assert.assertEquals("Result not as expected",19.6,
pc.calculatePercentage(5,25.5),0.1);
}
@Test
public void whenPass2DoubleNumbers_thenShouldCalculatePercentage(){
Assert.assertEquals("Result not as expected",20,
pc.calculatePercentage(5.5,27.5),0.1);
}
}