From fc4d96a9e3e20f8ddf035c16fc32b1effb75481b Mon Sep 17 00:00:00 2001 From: Sudipto Mallick Date: Sun, 28 Jan 2024 06:38:55 +0000 Subject: Complete all Java assignments --- java/output/AbstractShapeCalculations.typ | 19 ++++++++ java/output/CircularBaseExample.typ | 17 +++++++ java/output/CustomExceptionExample.typ | 13 ++++++ java/output/InnerClassExample.typ | 8 ++++ java/output/InterfaceExample.typ | 11 +++++ java/output/PackageExample.typ | 8 ++++ java/output/PackageInterfaceExample.typ | 8 ++++ java/output/RuntimePolymorphismExample.typ | 9 ++++ java/output/Template.typ | 4 ++ java/output/ThreadsExample.typ | 73 ++++++++++++++++++++++++++++++ 10 files changed, 170 insertions(+) create mode 100644 java/output/AbstractShapeCalculations.typ create mode 100644 java/output/CircularBaseExample.typ create mode 100644 java/output/CustomExceptionExample.typ create mode 100644 java/output/InnerClassExample.typ create mode 100644 java/output/InterfaceExample.typ create mode 100644 java/output/PackageExample.typ create mode 100644 java/output/PackageInterfaceExample.typ create mode 100644 java/output/RuntimePolymorphismExample.typ create mode 100644 java/output/Template.typ create mode 100644 java/output/ThreadsExample.typ (limited to 'java/output') diff --git a/java/output/AbstractShapeCalculations.typ b/java/output/AbstractShapeCalculations.typ new file mode 100644 index 0000000..c893f73 --- /dev/null +++ b/java/output/AbstractShapeCalculations.typ @@ -0,0 +1,19 @@ +#import "/template.typ": highlight-output +#highlight-output[``` +$ java AbstractShapeCalculations +Calculate and display shapes + +Rectangle + Enter length: 12 + Enter width: 8 +A rectangle with length 12.0 units and width 8.0 units has the area of 96.0 square units. + +Circle + Enter radius: 9 +A circle with radius 9.0 units has the area of 254.46900494077323 square units. + +Triangle + Enter three side lengths: 5 12 13 +A triangle with side lengths 5.0 units, 12.0 units and 13.0 units has the area of 30.0 square units. +```] + diff --git a/java/output/CircularBaseExample.typ b/java/output/CircularBaseExample.typ new file mode 100644 index 0000000..03769ae --- /dev/null +++ b/java/output/CircularBaseExample.typ @@ -0,0 +1,17 @@ +#import "/template.typ": highlight-output +#highlight-output[``` +$ java CircularBaseExample +Enter radius of Cone: 5 +Enter height of Cone: 8 +Enter radius of Cylinder: 7 +Enter height of Cylinder: 6 + +Cone base area: 78.53981633974483 +Cone total area: 204.20352248333654 +Cone volume: 209.43951023931953 + +Cylinder base area: 153.93804002589985 +Cylinder total area: 571.7698629533423 +Cylinder volume: 923.6282401553991 +```] + diff --git a/java/output/CustomExceptionExample.typ b/java/output/CustomExceptionExample.typ new file mode 100644 index 0000000..1e15b79 --- /dev/null +++ b/java/output/CustomExceptionExample.typ @@ -0,0 +1,13 @@ +#import "/template.typ": highlight-output +#highlight-output[``` +$ java CustomExceptionExample +Enter an integer: 23 +You entered: 23 +$ java CustomExceptionExample +Enter an integer: -4 +Number cannot be less than zero +$ java CustomExceptionExample +Enter an integer: abc +Input must be an integer. +```] + diff --git a/java/output/InnerClassExample.typ b/java/output/InnerClassExample.typ new file mode 100644 index 0000000..9c1abb1 --- /dev/null +++ b/java/output/InnerClassExample.typ @@ -0,0 +1,8 @@ +#import "/template.typ": highlight-output +#highlight-output[``` +$ java InnerClassExample +Outer member: 10 +Inner member: 20 +Inner member (through object): 20 +```] + diff --git a/java/output/InterfaceExample.typ b/java/output/InterfaceExample.typ new file mode 100644 index 0000000..4d2958b --- /dev/null +++ b/java/output/InterfaceExample.typ @@ -0,0 +1,11 @@ +#import "/template.typ": highlight-output +#highlight-output[``` +$ java InterfaceExample +Implementation of method1 +Implementation of method2 +Implementation of method3 +Implementation of method4 +Implementation of newMethod +Concrete method in the concrete class +```] + diff --git a/java/output/PackageExample.typ b/java/output/PackageExample.typ new file mode 100644 index 0000000..d80d8ab --- /dev/null +++ b/java/output/PackageExample.typ @@ -0,0 +1,8 @@ +#import "/template.typ": highlight-output +#highlight-output[``` +$ java PackageExample +MethodTwo in ClassTwo +Variable from ClassOne: 10 +From methodOne in ClassOne +```] + diff --git a/java/output/PackageInterfaceExample.typ b/java/output/PackageInterfaceExample.typ new file mode 100644 index 0000000..37a528d --- /dev/null +++ b/java/output/PackageInterfaceExample.typ @@ -0,0 +1,8 @@ +#import "/template.typ": highlight-output +#highlight-output[``` +$ java PackageInterfaceExample +Implementation of methodOne +Implementation of methodTwo +Implementation of methodThree +```] + diff --git a/java/output/RuntimePolymorphismExample.typ b/java/output/RuntimePolymorphismExample.typ new file mode 100644 index 0000000..132ff7f --- /dev/null +++ b/java/output/RuntimePolymorphismExample.typ @@ -0,0 +1,9 @@ +#import "/template.typ": highlight-output +#highlight-output[``` +$ java RuntimePolymorphismExample +Drawing a Circle +Drawing a Square +Calculating Circle Area +Calculating Square Area +```] + diff --git a/java/output/Template.typ b/java/output/Template.typ new file mode 100644 index 0000000..c1fa1d4 --- /dev/null +++ b/java/output/Template.typ @@ -0,0 +1,4 @@ +#import "/template.typ": highlight-output +#highlight-output[``` +```] + diff --git a/java/output/ThreadsExample.typ b/java/output/ThreadsExample.typ new file mode 100644 index 0000000..b6dbc81 --- /dev/null +++ b/java/output/ThreadsExample.typ @@ -0,0 +1,73 @@ +#import "/template.typ": highlight-output +#v(0.8em) +#columns(2)[ +#highlight-output[``` +$ java ThreadsExample +Subclass Thread 13 - Tick 1 +Subclass Thread 13 - Tick 2 +Subclass Thread 13 - Tick 3 +Subclass Thread 13 - Tick 4 +Subclass Thread 13 - Tick 5 +```] +#highlight-output[``` +Subclass Thread 13 - Tick 6 +Subclass Thread 13 - Tick 7 +Subclass Thread 13 - Tick 8 +Subclass Thread 13 - Tick 9 +Subclass Thread 13 - Tick 10 +Runnable Thread 18 - Tick 1 +```] +#highlight-output[``` +Subclass Thread 14 - Tick 1 +Runnable Thread 18 - Tick 2 +Runnable Thread 17 - Tick 1 +Subclass Thread 14 - Tick 2 +Runnable Thread 17 - Tick 2 +Runnable Thread 16 - Tick 1 +Subclass Thread 15 - Tick 1 +Runnable Thread 16 - Tick 2 +Runnable Thread 17 - Tick 3 +Runnable Thread 17 - Tick 4 +Runnable Thread 17 - Tick 5 +Runnable Thread 17 - Tick 6 +Runnable Thread 17 - Tick 7 +Runnable Thread 17 - Tick 8 +Runnable Thread 17 - Tick 9 +Runnable Thread 17 - Tick 10 +Subclass Thread 14 - Tick 3 +Runnable Thread 18 - Tick 3 +Runnable Thread 16 - Tick 3 +Subclass Thread 14 - Tick 4 +Subclass Thread 14 - Tick 5 +Subclass Thread 14 - Tick 6 +Subclass Thread 14 - Tick 7 +Subclass Thread 14 - Tick 8 +Subclass Thread 14 - Tick 9 +```] +#colbreak() +#highlight-output[``` +Subclass Thread 14 - Tick 10 +Runnable Thread 16 - Tick 4 +Runnable Thread 16 - Tick 5 +Runnable Thread 16 - Tick 6 +Subclass Thread 15 - Tick 2 +Runnable Thread 16 - Tick 7 +Runnable Thread 18 - Tick 4 +Runnable Thread 18 - Tick 5 +Runnable Thread 18 - Tick 6 +Runnable Thread 18 - Tick 7 +Runnable Thread 18 - Tick 8 +Runnable Thread 16 - Tick 8 +Subclass Thread 15 - Tick 3 +Runnable Thread 16 - Tick 9 +Subclass Thread 15 - Tick 4 +Runnable Thread 18 - Tick 9 +Subclass Thread 15 - Tick 5 +Runnable Thread 16 - Tick 10 +Subclass Thread 15 - Tick 6 +Subclass Thread 15 - Tick 7 +Subclass Thread 15 - Tick 8 +Subclass Thread 15 - Tick 9 +Subclass Thread 15 - Tick 10 +Runnable Thread 18 - Tick 10 +```]] -- cgit 1.4.1-2-gfad0