Question: Write a class called Triangle.java. The class will have three instance variables representing the sides of a triangle (sideA, sideB, sideC). You should represent these
Write a class called Triangle.java. The class will have three instance variables representing the sides of a triangle (sideA, sideB, sideC). You should represent these instance variables as private integers. The triangle class will have two constructors: a default constructor, and a constructor that takes in three arguments. The arguments are the three sides of a triangle. You will then create accessor(getters) and mutator(setters) methods for each instance variable. Next you will implement the following instance method: Override method: public boolean equals(Object t) so that it checks if the current object (this) is equal to the parameter triangle t. (Two triangles are equal if the three sides of one triangle are equal to the three sides of the other triangle (The order of the sides does not matter) but, for simplicity, check only if as , bs and cs are equals.). Make sure to create a test class to demonstrate Triangle capabilities. ( upcasting and downcasting in java programing language)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
