diff --git a/Arvand_Darvish/ArvandDarvish b/Arvand_Darvish/ArvandDarvish
new file mode 100644
index 0000000..71a2d4e
--- /dev/null
+++ b/Arvand_Darvish/ArvandDarvish
@@ -0,0 +1,4 @@
+Full Name: Arvand Darvish
+Student Number: 9831137
+
+
diff --git a/Arvand_Darvish/workshop4&5/workshop5/.idea/description.html b/Arvand_Darvish/workshop4&5/workshop5/.idea/description.html
new file mode 100644
index 0000000..db5f129
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/.idea/description.html
@@ -0,0 +1 @@
+Simple Java application that includes a class with main()
method
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5/.idea/encodings.xml b/Arvand_Darvish/workshop4&5/workshop5/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5/.idea/misc.xml b/Arvand_Darvish/workshop4&5/workshop5/.idea/misc.xml
new file mode 100644
index 0000000..2fc6c34
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/.idea/misc.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5/.idea/modules.xml b/Arvand_Darvish/workshop4&5/workshop5/.idea/modules.xml
new file mode 100644
index 0000000..3088432
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5/.idea/project-template.xml b/Arvand_Darvish/workshop4&5/workshop5/.idea/project-template.xml
new file mode 100644
index 0000000..1f08b88
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/.idea/project-template.xml
@@ -0,0 +1,3 @@
+
+ IJ_BASE_PACKAGE
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5/.idea/uiDesigner.xml b/Arvand_Darvish/workshop4&5/workshop5/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5/.idea/workspace.xml b/Arvand_Darvish/workshop4&5/workshop5/.idea/workspace.xml
new file mode 100644
index 0000000..09846a2
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/.idea/workspace.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1587676990748
+
+
+ 1587676990748
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Circle.class b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Circle.class
new file mode 100644
index 0000000..7d946a6
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Circle.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/META-INF/worckshop5.kotlin_module b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/META-INF/worckshop5.kotlin_module
new file mode 100644
index 0000000..a49347a
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/META-INF/worckshop5.kotlin_module differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Main.class b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Main.class
new file mode 100644
index 0000000..a2a86a8
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Main.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Paint.class b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Paint.class
new file mode 100644
index 0000000..1b70398
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Paint.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Rectangle.class b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Rectangle.class
new file mode 100644
index 0000000..0f23c20
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Rectangle.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Shape.class b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Shape.class
new file mode 100644
index 0000000..7da91cb
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Shape.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Triangle.class b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Triangle.class
new file mode 100644
index 0000000..7515f3b
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5/out/production/worckshop5/Triangle.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5/src/Circle.java b/Arvand_Darvish/workshop4&5/workshop5/src/Circle.java
new file mode 100644
index 0000000..8eedb42
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/src/Circle.java
@@ -0,0 +1,47 @@
+import java.util.Objects;
+
+public class Circle {
+
+ private int radius;
+
+ Circle(int radius) {
+ this.radius = radius;
+ }
+
+ public double calculatePerimeter() {
+ return 2*3.14*radius;
+ }
+
+ public double calculateArea() {
+ return 3.14*radius*radius;
+ }
+
+ public void draw() {
+ System.out.println(toString());
+ System.out.println("Perimeter = " + calculatePerimeter());
+ System.out.println("Area = " + calculateArea());
+ System.out.println();
+ }
+
+ @Override
+ public String toString() {
+ return "Circle{" + " radius=" + getRadius() + '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Circle circle = (Circle) o;
+ return radius == circle.radius;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(radius);
+ }
+
+ public int getRadius() {
+ return radius;
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5/src/Main.java b/Arvand_Darvish/workshop4&5/workshop5/src/Main.java
new file mode 100644
index 0000000..fedccfa
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/src/Main.java
@@ -0,0 +1,22 @@
+public class Main {
+
+ public static void main(String[] args) {
+ Circle circle1 = new Circle(19);
+ Circle circle2 = new Circle(3);
+ Rectangle rect1 = new Rectangle(1,4,1,4);
+ Rectangle rect2 = new Rectangle(8,5,8,5);
+ Rectangle rect3 = new Rectangle(6,6,6,6);
+ Triangle tri1 = new Triangle(2,2,2);
+ Triangle tri2 = new Triangle(4,4,6);
+ Paint paint = new Paint();
+ paint.addCircle(circle1);
+ paint.addCircle(circle2);
+ paint.addRectangle(rect1);
+ paint.addRectangle(rect2);
+ paint.addRectangle(rect3);
+ paint.addTriangle(tri1);
+ paint.addTriangle(tri2);
+ paint.drawAll();
+ paint.printAll();
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5/src/Paint.java b/Arvand_Darvish/workshop4&5/workshop5/src/Paint.java
new file mode 100644
index 0000000..974cb33
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/src/Paint.java
@@ -0,0 +1,49 @@
+import java.util.ArrayList;
+
+public class Paint {
+ private ArrayList triangles = new ArrayList<>();
+ private ArrayList circles = new ArrayList<>();
+ private ArrayList rectangles = new ArrayList<>();
+
+ public void addTriangle(Triangle triangle) {
+ triangles.add(triangle);
+ }
+
+ public void addRectangle(Rectangle rectangle) {
+ rectangles.add(rectangle);
+ }
+
+ public void addCircle(Circle circle) {
+ circles.add(circle);
+ }
+
+ public void drawAll() {
+ for (Triangle a: triangles) {
+ a.draw();
+ }
+ System.out.println();
+ for (Rectangle a: rectangles) {
+ a.draw();
+ }
+ System.out.println();
+ for (Circle a: circles) {
+ a.draw();
+ }
+ System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$");
+ }
+
+ public void printAll() {
+ for (Triangle a: triangles) {
+ System.out.println(a.toString());
+ }
+ System.out.println();
+ for (Rectangle a: rectangles) {
+ System.out.println(a.toString());
+ }
+ System.out.println();
+ for (Circle a: circles) {
+ System.out.println(a.toString());
+ }
+ System.out.println("***********************");
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5/src/Rectangle.java b/Arvand_Darvish/workshop4&5/workshop5/src/Rectangle.java
new file mode 100644
index 0000000..4e8c008
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/src/Rectangle.java
@@ -0,0 +1,59 @@
+import java.util.ArrayList;
+import java.util.Objects;
+
+public class Rectangle {
+ private ArrayList sides;
+
+ Rectangle(double side1, double side2, double side3, double side4) {
+ sides = new ArrayList<>();
+ sides.add(side1);
+ sides.add(side2);
+ sides.add(side3);
+ sides.add(side4);
+ }
+
+ public double calculatePerimeter() {
+ double sum = 0;
+ for (double side : sides) {
+ sum += side;
+ }
+ return sum;
+ }
+
+ public double calculateArea() {
+ return sides.get(0) * sides.get(1);
+ }
+
+ public void draw() {
+ System.out.println(toString());
+ System.out.println("Perimeter = " + calculatePerimeter());
+ System.out.println("Area = " + calculateArea());
+ System.out.println();
+ }
+
+ @Override
+ public String toString() {
+ return "Rectangle{" + "sides=" + getSides() + '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Rectangle rectangle = (Rectangle) o;
+ return Objects.equals(sides, rectangle.sides);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sides);
+ }
+
+ public ArrayList getSides() {
+ return sides;
+ }
+
+ public boolean isSquare() {
+ return sides.get(0).equals(sides.get(1)) && sides.get(2).equals(sides.get(3)) && sides.get(0).equals(sides.get(2));
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5/src/Shape.java b/Arvand_Darvish/workshop4&5/workshop5/src/Shape.java
new file mode 100644
index 0000000..f389731
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/src/Shape.java
@@ -0,0 +1,3 @@
+public class Shape {
+
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5/src/Triangle.java b/Arvand_Darvish/workshop4&5/workshop5/src/Triangle.java
new file mode 100644
index 0000000..055d4db
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/src/Triangle.java
@@ -0,0 +1,60 @@
+import java.util.ArrayList;
+import java.util.Objects;
+
+public class Triangle {
+
+ private ArrayList sides;
+
+ Triangle(double side1, double side2, double side3) {
+ sides = new ArrayList<>();
+ sides.add(side1);
+ sides.add(side2);
+ sides.add(side3);
+ }
+
+ public double calculatePerimeter() {
+ double sum = 0;
+ for (double side : sides) {
+ sum += side;
+ }
+ return sum;
+ }
+
+ public double calculateArea() {
+ double p = (calculatePerimeter()/2);
+ return Math.sqrt(p * (p - sides.get(0)) * (p - sides.get(1)) * (p - sides.get(2)));
+ }
+
+ public void draw() {
+ System.out.println(toString());
+ System.out.println("Perimeter = " + calculatePerimeter());
+ System.out.println("Area = " + calculateArea());
+ System.out.println();
+ }
+
+ @Override
+ public String toString() {
+ return "Triangle{" + "sides=" + getSides() + '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Triangle triangle = (Triangle) o;
+ return Objects.equals(sides, triangle.sides);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sides);
+ }
+
+ public ArrayList getSides() {
+ return sides;
+ }
+
+ public boolean isEquilateral() {
+ return sides.get(0).equals(sides.get(1)) && sides.get(0).equals(sides.get(2));
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5/workshop5.iml b/Arvand_Darvish/workshop4&5/workshop5/workshop5.iml
new file mode 100644
index 0000000..d5c0743
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5/workshop5.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/description.html b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/description.html
new file mode 100644
index 0000000..db5f129
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/description.html
@@ -0,0 +1 @@
+Simple Java application that includes a class with main()
method
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/encodings.xml b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/misc.xml b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/misc.xml
new file mode 100644
index 0000000..89e42c1
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/modules.xml b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/modules.xml
new file mode 100644
index 0000000..91511dd
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/project-template.xml b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/project-template.xml
new file mode 100644
index 0000000..1f08b88
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/project-template.xml
@@ -0,0 +1,3 @@
+
+ IJ_BASE_PACKAGE
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/uiDesigner.xml b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/workspace.xml b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/workspace.xml
new file mode 100644
index 0000000..2c99ad9
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/.idea/workspace.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1587739797439
+
+
+ 1587739797439
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Circle.class b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Circle.class
new file mode 100644
index 0000000..8cd7013
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Circle.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Main.class b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Main.class
new file mode 100644
index 0000000..6c78183
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Main.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Paint.class b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Paint.class
new file mode 100644
index 0000000..17033e6
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Paint.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Polygon.class b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Polygon.class
new file mode 100644
index 0000000..aa6ed96
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Polygon.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Rectangle.class b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Rectangle.class
new file mode 100644
index 0000000..09d1748
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Rectangle.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Shape.class b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Shape.class
new file mode 100644
index 0000000..cdc6c68
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Shape.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Triangle.class b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Triangle.class
new file mode 100644
index 0000000..b1a31d4
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/out/production/workshop5editedWithInheritance/Triangle.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Circle.java b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Circle.java
new file mode 100644
index 0000000..52318dc
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Circle.java
@@ -0,0 +1,47 @@
+import java.util.Objects;
+
+public class Circle extends Shape {
+
+ private int radius;
+
+ Circle(int radius) {
+ this.radius = radius;
+ }
+
+ public double calculatePerimeter() {
+ return 2*3.14*radius;
+ }
+
+ public double calculateArea() {
+ return 3.14*radius*radius;
+ }
+
+ public void draw() {
+ System.out.println(toString());
+ System.out.println("Perimeter = " + calculatePerimeter());
+ System.out.println("Area = " + calculateArea());
+ System.out.println();
+ }
+
+ @Override
+ public String toString() {
+ return "Circle{" + " radius=" + radius + '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Circle circle = (Circle) o;
+ return radius == circle.radius;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getRadius());
+ }
+
+ public int getRadius() {
+ return radius;
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Main.java b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Main.java
new file mode 100644
index 0000000..c416170
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Main.java
@@ -0,0 +1,24 @@
+public class Main {
+
+ public static void main(String[] args) {
+ Shape circle1 = new Circle(19);
+ Shape circle2 = new Circle(3);
+ Rectangle rect1 = new Rectangle(1,4,1,4);
+ Polygon rect2 = new Rectangle(8,5,8,5);
+ Rectangle rect3 = new Rectangle(6,6,6,6);
+ Polygon tri1 = new Triangle(2,2,2);
+ Triangle tri2 = new Triangle(4,4,6);
+ Shape tri3 = new Triangle(2,2,2);
+
+ Paint paint = new Paint();
+ paint.addShape(circle1); paint.addShape(circle2);
+ paint.addShape(rect1); paint.addShape(rect2); paint.addShape(rect3);
+ paint.addShape(tri1); paint.addShape(tri2); paint.addShape(tri3);
+
+ paint.drawAll();
+ System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+ paint.printAll();
+ System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+ paint.describeEqualSides();
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Paint.java b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Paint.java
new file mode 100644
index 0000000..14536b6
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Paint.java
@@ -0,0 +1,32 @@
+import java.util.ArrayList;
+
+public class Paint {
+ private ArrayList shapes = new ArrayList<>();
+
+ public void addShape(Shape shape) {
+ shapes.add(shape);
+ }
+
+ public void drawAll() {
+ for (Shape a: shapes) {
+ a.draw();
+ }
+ System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$");
+ }
+
+ public void printAll() {
+ for (Shape a: shapes) {
+ System.out.println(a.toString());
+ }
+ System.out.println("***********************");
+ }
+
+ public void describeEqualSides() {
+ for (Shape a: shapes) {
+ if(a instanceof Rectangle && ((Rectangle) a).isSquare())
+ System.out.println(a.toString());
+ if(a instanceof Triangle && ((Triangle) a).isEquilateral())
+ System.out.println(a.toString());
+ }
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Polygon.java b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Polygon.java
new file mode 100644
index 0000000..c9722e3
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Polygon.java
@@ -0,0 +1,16 @@
+import java.util.ArrayList;
+
+abstract public class Polygon extends Shape {
+ protected ArrayList sides;
+
+ Polygon(double... varargs) {
+ sides = new ArrayList<>();
+ for (double vararg : varargs) {
+ sides.add(vararg);
+ }
+ }
+
+ public ArrayList getSides() {
+ return sides;
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Rectangle.java b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Rectangle.java
new file mode 100644
index 0000000..0162843
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Rectangle.java
@@ -0,0 +1,50 @@
+import java.util.Objects;
+
+public class Rectangle extends Polygon {
+
+ Rectangle(double side1, double side2, double side3, double side4) {
+ super(side1, side2, side3, side4);
+ }
+
+ public double calculatePerimeter() {
+ double sum = 0;
+ for (double side : getSides()) {
+ sum += side;
+ }
+ return sum;
+ }
+
+ public double calculateArea() {
+ return sides.get(0) * sides.get(1);
+ }
+
+ public void draw() {
+ System.out.println(toString());
+ System.out.println("Perimeter = " + calculatePerimeter());
+ System.out.println("Area = " + calculateArea());
+ System.out.println();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder str = new StringBuilder("Rectangle : ");
+ int count = 1;
+ for (double a: getSides()) {
+ str.append("side").append(count++).append(" : ").append(a).append(" ");
+ }
+ return str.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Rectangle rectangle = (Rectangle) o;
+ return Objects.equals(sides, rectangle.sides);
+ }
+
+
+ public boolean isSquare() {
+ return sides.get(0).equals(sides.get(1)) && sides.get(2).equals(sides.get(3)) && sides.get(0).equals(sides.get(2));
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Shape.java b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Shape.java
new file mode 100644
index 0000000..e5c1026
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Shape.java
@@ -0,0 +1,15 @@
+abstract public class Shape {
+
+ abstract public double calculatePerimeter();
+ abstract public double calculateArea();
+ abstract public void draw();
+
+ @Override
+ public boolean equals(Object obj) {
+ return super.equals(obj);
+ }
+
+ public String toString() {
+ return super.toString();
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Triangle.java b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Triangle.java
new file mode 100644
index 0000000..62f3a22
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/src/Triangle.java
@@ -0,0 +1,56 @@
+import java.util.Objects;
+
+public class Triangle extends Polygon {
+
+ Triangle(double side1, double side2, double side3) {
+ super(side1, side2, side3);
+ }
+
+ @Override
+ public double calculatePerimeter() {
+ double sum = 0;
+ for (double side : getSides()) {
+ sum += side;
+ }
+ return sum;
+ }
+
+ public double calculateArea() {
+ double p = (calculatePerimeter()/2);
+ return Math.sqrt(p * (p - sides.get(0)) * (p - sides.get(1)) * (p - sides.get(2)));
+ }
+
+ public void draw() {
+ System.out.println(toString());
+ System.out.println("Perimeter = " + calculatePerimeter());
+ System.out.println("Area = " + calculateArea());
+ System.out.println();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder str = new StringBuilder("Triangle : ");
+ int count = 1;
+ for (double a: getSides()) {
+ str.append("side").append(count++).append(" : ").append(a).append(" ");
+ }
+ return str.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Triangle triangle = (Triangle) o;
+ return Objects.equals(sides, triangle.sides);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sides);
+ }
+
+ public boolean isEquilateral() {
+ return sides.get(0).equals(sides.get(1)) && sides.get(0).equals(sides.get(2));
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/workshop5editedWithInheritance.iml b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/workshop5editedWithInheritance.iml
new file mode 100644
index 0000000..d5c0743
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshop5editedWithInheritance/workshop5editedWithInheritance.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/.idea/description.html b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/description.html
new file mode 100644
index 0000000..db5f129
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/description.html
@@ -0,0 +1 @@
+Simple Java application that includes a class with main()
method
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/.idea/encodings.xml b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/.idea/libraries/JalaliCalendar_1_3_1.xml b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/libraries/JalaliCalendar_1_3_1.xml
new file mode 100644
index 0000000..3670938
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/libraries/JalaliCalendar_1_3_1.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/.idea/misc.xml b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/misc.xml
new file mode 100644
index 0000000..89e42c1
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/.idea/modules.xml b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/modules.xml
new file mode 100644
index 0000000..172cd95
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/.idea/project-template.xml b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/project-template.xml
new file mode 100644
index 0000000..1f08b88
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/project-template.xml
@@ -0,0 +1,3 @@
+
+ IJ_BASE_PACKAGE
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/.idea/uiDesigner.xml b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/.idea/workspace.xml b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/workspace.xml
new file mode 100644
index 0000000..3cf7f32
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/.idea/workspace.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1587645601713
+
+
+ 1587645601713
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Main.class b/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Main.class
new file mode 100644
index 0000000..f95f309
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Main.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Person.class b/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Person.class
new file mode 100644
index 0000000..294a6e3
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Person.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Vote.class b/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Vote.class
new file mode 100644
index 0000000..420e6e0
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Vote.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Voting.class b/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Voting.class
new file mode 100644
index 0000000..55aa913
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/Voting.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/VotingSystem.class b/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/VotingSystem.class
new file mode 100644
index 0000000..7d7a481
Binary files /dev/null and b/Arvand_Darvish/workshop4&5/workshopSession4/out/production/workshopSession4/VotingSystem.class differ
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/src/Main.java b/Arvand_Darvish/workshop4&5/workshopSession4/src/Main.java
new file mode 100644
index 0000000..29a051f
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/src/Main.java
@@ -0,0 +1,73 @@
+import java.util.ArrayList;
+
+/**
+ * this class has some examples for running the code.
+ *
+ * @version 0.0
+ * @author Arvand
+ */
+public class Main {
+
+ public static void main(String[] args) {
+ VotingSystem poll = new VotingSystem();
+
+ ArrayList options1 = new ArrayList<>();
+ options1.add("Leo Dicaprio"); options1.add("Brad Pitt"); options1.add("Steve Carrel");
+ poll.createVoting("Who would you rather ?", 0, options1);
+
+ ArrayList options2 = new ArrayList<>();
+ options2.add("Drake"); options2.add("Travis Scott"); options2.add("The Weeknd");
+ poll.createVoting("Who would you prefer ?", 1, options2);
+
+ System.out.println("what poll(s) do we have : ");
+ poll.printListOfVotingQuestions();
+
+ System.out.println();
+
+ System.out.println("poll 1 :");
+ poll.getVoting(0);
+
+ System.out.println();
+
+ System.out.println("poll 2 :");
+ poll.getVoting(1);
+
+ Person Ali = new Person("Ali", "Karimi");
+ ArrayList aliOption1 = new ArrayList<>();
+ aliOption1.add("Leo Dicaprio");
+ ArrayList aliOption2 = new ArrayList<>();
+ aliOption2.add("The Weeknd"); aliOption2.add("Drake");
+
+ Person Arvand = new Person("Arvand", "Darvish");
+ ArrayList arvandOption1 = new ArrayList<>();
+ arvandOption1.add("Steve Carrel");
+ ArrayList arvandOption2 = new ArrayList<>();
+ arvandOption2.add("Drake"); arvandOption2.add("Travis Scott");
+
+ Person Shaqayeq = new Person("Shaqayeq", "Sabouri");
+ ArrayList shaqayeqOption1 = new ArrayList<>();
+ shaqayeqOption1.add("Steve Carrel");
+ ArrayList shaqayeqOption2 = new ArrayList<>();
+ shaqayeqOption2.add("Drake");
+
+ poll.vote(0, Ali, aliOption1);
+ poll.vote(0, Arvand, arvandOption1); poll.vote(0, Shaqayeq, shaqayeqOption1);
+
+ poll.vote(1, Ali, aliOption2); poll.vote(1, Arvand, arvandOption2); poll.vote(1, Shaqayeq, shaqayeqOption2);
+
+ System.out.println("\nresults for poll 1 :");
+ poll.getResult(0);
+
+ System.out.println("\nresults for poll 2 :");
+ poll.getResult(1);
+
+ System.out.println("\nvoters are :");
+ poll.getVotingList().get(0).getVoters();
+
+ //in this part we showed the specifications of each option, here we showed the specifications of Drake's votes.
+ System.out.println("\nvotes for Drake in poll 2 :");
+ for (Vote a: poll.getVotingList().get(1).getChoices().get("Drake")) {
+ System.out.println(a.getPerson().getFirstName() + " " + a.getPerson().getLastName() + " : " + a.getDate());
+ }
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/src/Person.java b/Arvand_Darvish/workshop4&5/workshopSession4/src/Person.java
new file mode 100644
index 0000000..93b559f
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/src/Person.java
@@ -0,0 +1,17 @@
+public class Person {
+ private String firstName;
+ private String lastName;
+
+ public Person(String firstName, String lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/src/Vote.java b/Arvand_Darvish/workshop4&5/workshopSession4/src/Vote.java
new file mode 100644
index 0000000..f4838e1
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/src/Vote.java
@@ -0,0 +1,18 @@
+public class Vote {
+ private Person person;
+ private String date;
+
+ public Vote(Person person, String date) {
+ this.person = person;
+ this.date = date;
+ }
+
+ public Person getPerson() {
+ return person;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+}
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/src/Voting.java b/Arvand_Darvish/workshop4&5/workshopSession4/src/Voting.java
new file mode 100644
index 0000000..8a425ad
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/src/Voting.java
@@ -0,0 +1,58 @@
+import ir.huri.jcal.JalaliCalendar;
+
+import java.util.*;
+
+public class Voting {
+
+ private int type;
+ private ArrayList voters;
+ private String question;
+ private HashMap> choices = new HashMap<>();
+
+ public Voting(int type, String question) {
+ this.type = type;
+ this.question = question;
+ voters = new ArrayList<>();
+ }
+
+ public void vote(Person person, ArrayList chosenOptions) {
+ Random random = new Random();
+ JalaliCalendar date = new JalaliCalendar(random.nextInt(11)+1388,random.nextInt(12)+1,random.nextInt(30)+1);
+ Vote tmpVote = new Vote(person, date.toString());
+ voters.add(person.getFirstName());
+ if(type == 1) {
+ for (String a : chosenOptions) {
+ choices.get(a).add(tmpVote);
+ }
+ } else
+ choices.get(chosenOptions.get(0)).add(tmpVote);
+ }
+
+ public void getVoters() {
+ for (String a: voters) {
+ System.out.println(a);
+ }
+ }
+
+
+ public String getQuestion() {
+ return question;
+ }
+
+ public HashMap> getChoices() {
+ return choices;
+ }
+
+ public void createChoice(String choice) {
+ choices.put(choice, new HashSet<>());
+ }
+
+
+ public void showResult() {
+ System.out.println(getQuestion());
+ for (String a: getChoices().keySet()) {
+ System.out.print(a);
+ System.out.println(" " + choices.get(a).size());
+ }
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/src/VotingSystem.java b/Arvand_Darvish/workshop4&5/workshopSession4/src/VotingSystem.java
new file mode 100644
index 0000000..90c796c
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/src/VotingSystem.java
@@ -0,0 +1,43 @@
+import java.util.ArrayList;
+
+public class VotingSystem {
+ private ArrayList votingList;
+
+ public VotingSystem() {
+ votingList = new ArrayList<>();
+ }
+
+ public void printListOfVotingQuestions() {
+ for (Voting a: votingList) {
+ System.out.println(a.getQuestion());
+ }
+ }
+
+ public ArrayList getVotingList() {
+ return votingList;
+ }
+
+ public void createVoting(String question, int type, ArrayList options) {
+ Voting newVoting = new Voting(type, question);
+ for (String a: options) {
+ newVoting.createChoice(a);
+ }
+ votingList.add(newVoting);
+ }
+
+ public void getVoting(int index) {
+ Voting tmp = getVotingList().get(index);
+ System.out.println(tmp.getQuestion());
+ for (String a: tmp.getChoices().keySet()) {
+ System.out.println(a);
+ }
+ }
+
+ public void vote(int index, Person person, ArrayList chosenOptions) {
+ votingList.get(index).vote(person, chosenOptions);
+ }
+
+ public void getResult(int index) {
+ votingList.get(index).showResult();
+ }
+}
diff --git a/Arvand_Darvish/workshop4&5/workshopSession4/workshopSession4.iml b/Arvand_Darvish/workshop4&5/workshopSession4/workshopSession4.iml
new file mode 100644
index 0000000..3febc4d
--- /dev/null
+++ b/Arvand_Darvish/workshop4&5/workshopSession4/workshopSession4.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file