Question: Please try your best This is Java Programming Please comment most of the lines for I understand what you did. I assume this can be
Please try your best
This is Java Programming
Please comment most of the lines for I understand what you did.
I assume this can be done in any IDE that uses Java

1. Create a new package under the src folder named cop2210.geometry.figures 2. Create a new class under the cop 2210.geometry.figures package named Circle and add the following fields to the class radius: Variable to store the length of a circle's radius opi: Variable to store a mathematical constant equals to 3.14159 (IT) 3. Create a new class under the cop2210.geometry.figures package named Triangle and add the following fields to the class side 1. side2 side3 : Variables to store the length of each side of a triangle height : Variable to store the distance from side1 to the opposite angle. 4. Create a new class under the cop 2210.geometry.figures package named Square and add the following field to the class side: Variable to store the length of each square's side. 5. Create a new class under the cop2210.geometry.figures package named Rectangle and add the following field to the class shortSide: Variable to store the length of the shortest side of a rectangle. longside: Variable to store the length of the longest side of a rectangle. 6. Make sure that all variables created above are private 7. Generate getter and setter methods for each private variable 8. Add a public method inside each class with signature public double area() to calculate the area of the figure represented by that class. Circle Area: A = pi*r*r Triangle Area : A = (side1 * height)/2 Square Area: A = side * side Rectangle Area: A = shortSide * longside 8. Add a public method inside each class with signature public double perimeter() to calculate the perimeter of the figure represented by that class. Circle Perimeter: P = 2*r* pi Triangle Perimeter: P = side 1 + side 2 + side3 Square Perimeter: P = 4 * side Rectangle Perimeter: P = 2 * shortSide + 2 * longside Testing: Create a new Geomety Main class with the main method under cop 2210.geometry.figures. Inside the main method, create an object of each class, assign value to the instance variables, and calculate area and perimeter. For example: Circle my Circle = new Circle(); myCircle.setRadius(20); System.out.println("Area: "+my Circle.area(); System.out.println("Perimeter: "+myCircle.perimeter())
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
