Browse Source

Binomische Formel + Test

remotes/origin/develop
fdai7460 2 years ago
parent
commit
e4fedff499
  1. 14
      src/main/java/src/TasksFrame.java
  2. 13
      src/test/java/src/TasksFrameTest.java

14
src/main/java/src/TasksFrame.java

@ -8,6 +8,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.lang.Character;
public class TasksFrame extends JFrame { public class TasksFrame extends JFrame {
@ -191,8 +193,6 @@ public class TasksFrame extends JFrame {
return Math.round(result * 100.0) / 100.0; return Math.round(result * 100.0) / 100.0;
} }
private void setupDurchschnitt() { private void setupDurchschnitt() {
JPanel jPanel = setupPanel("Durchschnitt"); JPanel jPanel = setupPanel("Durchschnitt");
@ -247,8 +247,6 @@ public class TasksFrame extends JFrame {
} }
private void setupExponent() { private void setupExponent() {
JPanel jPanel = setupPanel("Potenzrechner"); JPanel jPanel = setupPanel("Potenzrechner");
@ -391,6 +389,7 @@ public class TasksFrame extends JFrame {
return steuer; return steuer;
} }
private void setupSteuer() private void setupSteuer()
{ {
JPanel jPanel = setupPanel("Steuer Berechner von Kaufprodukten"); JPanel jPanel = setupPanel("Steuer Berechner von Kaufprodukten");
@ -980,6 +979,13 @@ public class TasksFrame extends JFrame {
jPanel.add(k); jPanel.add(k);
} }
public int bin1(int a, int b)
{
int x = 0;
x = a*a + 2*a*b + b*b;
return x;
}
public void setupArea() public void setupArea()
{ {

13
src/test/java/src/TasksFrameTest.java

@ -2,10 +2,21 @@ package src;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
class TasksFrameTest { class TasksFrameTest {
@Test
void bin1() {
TasksFrame tasksFrame = new TasksFrame();
int x = tasksFrame.bin1(5, 4);
assertEquals(81, x);
int x2 = tasksFrame.bin1(7,3);
assertEquals(100,x2);
}
@Test @Test
void setupPI() { void setupPI() {
TasksFrame tasksFrame = new TasksFrame(); TasksFrame tasksFrame = new TasksFrame();
@ -37,7 +48,7 @@ class TasksFrameTest {
assertEquals(273.15,x3,0.01); assertEquals(273.15,x3,0.01);
} }
@Test @Test
void setupSteuer19(){ void setupSteuer19(){
TasksFrame tasksFrame = new TasksFrame(); TasksFrame tasksFrame = new TasksFrame();

Loading…
Cancel
Save