Skip to content

Commit af83750

Browse files
committed
Add comments
1 parent 542f5fc commit af83750

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

src/Lab_I/ClassPackage/Circle.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
public class Circle extends Point {
44
private double radius;
55

6+
// 6. Initializer
67
{
78
radius = 1;
89
}
@@ -22,6 +23,7 @@ public double getArea() {
2223
return Math.PI * Math.pow(getRadius(), 2);
2324
}
2425

26+
// 7. Get and Set methods
2527
public double getRadius() {
2628
return radius;
2729
}

src/Lab_I/ClassPackage/Point.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
public class Point implements AreaCalculable {
66
private double coordinateX, coordinateY;
77

8+
// 2. Overloaded methods
89
public Point() {
910
this.coordinateX = this.coordinateY = 0;
1011
}
@@ -18,6 +19,7 @@ public double getArea() {
1819
return 0;
1920
}
2021

22+
// 5. static method
2123
static boolean isPositiveRealNumber(double value) {
2224
return Double.isFinite(value) && (value > 0);
2325
}

src/Lab_I/ClassPackage/Rectangle.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
public class Rectangle extends Point {
44
private double width, height;
55

6+
// 6. Initializer
67
{
78
width = 1;
89
height = 1;
@@ -19,6 +20,7 @@ public Rectangle(double centerCoordinateX, double centerCoordinateY, double widt
1920
}
2021
}
2122

23+
// 1. Overridden method
2224
@Override
2325
public double getArea() {
2426
return getWidth() * getHeight();

src/Lab_I/Solver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package Lab_I;
22

3+
// 4. Using two packages
34
import Lab_I.ClassPackage.*;
45
import Lab_I.InterfacePackage.*;
56
import java.util.*;
67

78
public class Solver {
89
public static void main() {
10+
// 3. Link to interface "AreaCalculable" and use interface method "getArea"
911
List<AreaCalculable> someShapes = Arrays.asList(
1012
new Point(),
1113
new Point(0,0),

0 commit comments

Comments
 (0)