Browse Source

Merge remote-tracking branch 'origin/develop' into develop

remotes/origin/develop
fdai6499 2 years ago
parent
commit
94620028f2
  1. 4
      src/main/java/src/TasksFrame.java
  2. 21
      src/test/java/src/TasksFrameTest.java

4
src/main/java/src/TasksFrame.java

@ -130,11 +130,11 @@ public class TasksFrame extends JFrame {
public int roundSum(int a, int b, int c) {
return runde10(a) + runde10(b) + runde10(c);
return round10(a) + round10(b) + round10(c);
}
public int runde10(int n) {
public int round10(int n) {
if (n % 10 >= 5) {
return n + 10 - n % 10;
}

21
src/test/java/src/TasksFrameTest.java

@ -126,6 +126,27 @@ class TasksFrameTest {
assertEquals(70, c);
}
@Test
void test_roundSum(){
TasksFrame tasksFrame = new TasksFrame();
int a = tasksFrame.roundSum(15, 21, 12);
assertEquals(50, a);
int b = tasksFrame.roundSum(48, 25, 17);
assertEquals(100, b);
int c = tasksFrame.roundSum(13, 9, 26);
assertEquals(50, c);
}
@Test
void test_round10(){
TasksFrame tasksFrame = new TasksFrame();
int a = tasksFrame.round10(15);
assertEquals(20, a);
int b = tasksFrame.round10(56);
assertEquals(60, b);
int c = tasksFrame.round10(12);
assertEquals(10, c);
}
}

Loading…
Cancel
Save