Browse Source

Temperatur Umrechner

remotes/origin/develop
fdai7460 2 years ago
parent
commit
2c668c31c7
  1. 6
      src/main/java/src/TasksFrame.java
  2. 19
      src/test/java/src/TasksFrameTest.java

6
src/main/java/src/TasksFrame.java

@ -720,6 +720,12 @@ public class TasksFrame extends JFrame {
} }
public double temperatur(double tem){
double x=0;
x = tem + 273.15;
return x;
}
public void setupArea() public void setupArea()
{ {
JPanel jPanel = setupPanel("Area and perimeter of a Rectangle:"); JPanel jPanel = setupPanel("Area and perimeter of a Rectangle:");

19
src/test/java/src/TasksFrameTest.java

@ -18,11 +18,24 @@ class TasksFrameTest {
{ {
TasksFrame tasksFrame = new TasksFrame(); TasksFrame tasksFrame = new TasksFrame();
int x = tasksFrame.Fakultaet(5); int x = tasksFrame.Fakultaet(5);
assertEquals(120,x);
assertEquals(120, x, 0.01);
int x2 = tasksFrame.Fakultaet(1); int x2 = tasksFrame.Fakultaet(1);
assertEquals(1,x2);
assertEquals(1, x2, 0.01);
int x3 = tasksFrame.Fakultaet(0); int x3 = tasksFrame.Fakultaet(0);
assertEquals(0,x3);
assertEquals(0, x3, 0.01);
}
@Test
void setupTemperatur()
{
TasksFrame tasksFrame = new TasksFrame();
double x = tasksFrame.temperatur(-10.6);
assertEquals(262.55,x);
double x2 = tasksFrame.temperatur(8.0);
assertEquals(281.15,x2);
double x3 = tasksFrame.temperatur(0);
assertEquals(273.15,x3);
} }
@Test @Test

Loading…
Cancel
Save