summary refs log tree commit diff stats
path: root/java/text/ShapeAreaCalculations.typ
diff options
context:
space:
mode:
authorSudipto Mallick <smlckz@termux-alpine>2024-01-27 11:33:43 +0000
committerSudipto Mallick <smlckz@termux-alpine>2024-01-27 11:34:11 +0000
commitcd6a9243c056710794549a1ab5d51fbdd082ce2e (patch)
treef3f4df42bcfa96b9d6ef48da2b33be148adfdd2b /java/text/ShapeAreaCalculations.typ
parent1db2841d10c6920eba89f1e55eb3c90aa770ad07 (diff)
downloadzadania-cd6a9243c056710794549a1ab5d51fbdd082ce2e.tar.gz
Complete Java assignments #7-13
Diffstat (limited to 'java/text/ShapeAreaCalculations.typ')
-rw-r--r--java/text/ShapeAreaCalculations.typ27
1 files changed, 27 insertions, 0 deletions
diff --git a/java/text/ShapeAreaCalculations.typ b/java/text/ShapeAreaCalculations.typ
new file mode 100644
index 0000000..f34c1a0
--- /dev/null
+++ b/java/text/ShapeAreaCalculations.typ
@@ -0,0 +1,27 @@
+#import "/template.typ": *
+#show: A => apply(A)
+#set raw(lang: "java-new")
+#set par(leading: 0.6em)
+
+#assignment(13)[
+  Write a program to create a class `Shape` with 4 methods to calculate the areas of triangle, rectangle, square, and circle using method overloading.
+]
+
+#scos("ShapeAreaCalculations")
+
+=== Discussion
+
+#skind[Classes and methods implemented in the program]
+
+- The `Shape` class provides static methods for calculating the area of different geometric shapes:
+  - `static double area(double a, double b, double c)`: Calculates the area of a triangle using its side lengths.
+  - `static int area(int length, int width)`: Calculates the area of a rectangle using its length and width.
+  - `static int area(int sideLength)`: Calculates the area of a square using its side length.
+  - `static double area(double radius)`: Calculates the area of a circle using its radius.
+
+- The `ShapeAreaCalculations` class contains the main program for calculating the area of geometric shapes based on user input through a menu-driven interface:
+  - `static void menu()`: Displays a menu of shape choices.
+  - `public static void main(String[])`: Implements a menu-driven program for calculating the area of different shapes (_i.e._ triangle, rectangle, square, or circle) based on user input.
+
+  
+#signature()