Changed return type of static method to long
This commit is contained in:
parent
6391285dd2
commit
14b6193fff
|
@ -12,8 +12,8 @@ public class RoundUpToHundred {
|
|||
RoundUpToHundred.round(input);
|
||||
}
|
||||
|
||||
static int round(double input) {
|
||||
int i = (int) Math.ceil(input);
|
||||
static long round(double input) {
|
||||
long i = (int) Math.ceil(input);
|
||||
return ((i + 99) / 100) * 100;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.junit.Test;
|
|||
|
||||
public class RoundUpToHundredTest {
|
||||
@Test
|
||||
public void givenInput_whenRoundedUp_thenTrue() {
|
||||
public void givenInput_whenRound_thenRoundUpToTheNearestHundred() {
|
||||
assertEquals("Rounded up to hundred", 100, RoundUpToHundred.round(99));
|
||||
assertEquals("Rounded up to three hundred ", 300, RoundUpToHundred.round(200.2));
|
||||
assertEquals("Returns same rounded value", 400, RoundUpToHundred.round(400));
|
||||
|
|
Loading…
Reference in New Issue