From 3d989ef1fa73de2f1f89fdb77fa67122296400d9 Mon Sep 17 00:00:00 2001 From: Juuso Rytilahti <juuso.b.rytilahti@utu.fi> Date: Thu, 16 May 2024 11:58:17 +0000 Subject: [PATCH] translated text --- exercise3.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/exercise3.java b/exercise3.java index accba03..de1acc4 100644 --- a/exercise3.java +++ b/exercise3.java @@ -59,12 +59,12 @@ public class Exercise3 { assert (x1 >= x2); assert (y1 >= y2); - // triangle: draw a square around it and calculate half of the area - // square: ala = side * other side + // triangle: draw a quadrilateral around it and calculate half of the area + // quadrilateral: ala = side * other side // circle: area = pi * r^2 ja r = sqrt(dx^2 + dy^2), so area = pi * (dx^2 + dy^2) return switch ((String) ps[0]) { case "triangle" -> (x1 - x2) * (y1 - y2) / 2; - case "square" -> (x1 - x2) * (y1 - y2); + case "quadrilateral" -> (x1 - x2) * (y1 - y2); case "circle" -> Math.PI * ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); default -> throw new Exception("Unfalimiar pattern!"); }; @@ -87,18 +87,18 @@ public class Exercise3 { if (p2[0].equals("triangle")) p2[3] = readPoint(); - // laske kuvioiden käsittämien alueiden pinta-ala - // kuvioiden asettumista päällekkäin ei tarvitse huomioida + // Calculate the area covered by the patterns + // No need to take into account the overlapping of patterns { double area_sum = 0; area_sum += area(p1); area_sum += area(p2); - System.out.printf("Kuvioiden pinta-alan summa:\n%f\n\n", area_sum); + System.out.printf("Sum of area covered by the patterns:\n%f\n\n", area_sum); } - // laske kuvioiden käsittämän alueen ulkorajat + // calculate the outer boundaries of the area covered by the patterns int x1 = Integer.MIN_VALUE, y1 = Integer.MIN_VALUE, @@ -126,7 +126,7 @@ public class Exercise3 { assert (x1 >= x2); assert (y1 >= y2); - System.out.printf("Kuvioiden yhteiset rajat:\n(%d, %d) x (%d, %d)\n\n", + System.out.printf("The common boundaries of the patterns:\n(%d, %d) x (%d, %d)\n\n", x2, y2, x1, y1); } } -- GitLab