Question: IN PSEUDOCODE for JAVA Define the following classes 2) Triangle a) Must have 3 private attributes to hold siden, side2 and side 3. Each of
IN PSEUDOCODE for JAVA
Define the following classes

2) Triangle a) Must have 3 private attributes to hold siden, side2 and side 3. Each of which should be of type double. b) Must have a constructor that takes in 3 parameters and sets the 3 attributes c) Must have an overloaded constructor that takes no parameters and sets the 3 attributes to sizes 3, 4 and 5. d) Must have a method called perimeter which takes in no parameters and returns a double. The perimeter of a triangle is calculated by adding side 1 +side2+side3 e) Must have a method called area which takes no parameters and returns a double. The area of a triangle is calculated as follows (You'll need to look up the square root function in the Math object in Java or C#): i) Calculate p=(side 1 +side2+side3)/2 ii) Take the square root of (p*(p-side 1)*(p-side2)*(p-side3)). f) Must have a method called height which takes no parameters and returns a double. The height of a triangle is calculated as follows: i) Find the smallest of the 3 sides (side1, side2 or side3) ii) Multiple the area of the triangle by 2, then divide that by the smallest side. g) Override the toString/ToString method in this class. Have it return a string that gives the details of the triangle. For example: "Triangle has sides x, y and z. It has an area of X and perimeter of Y
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
