Question: the code should be in java. please use variables for scanner input and also show me the results of the sample inputs. Implement the following

the code should be in java. please use variables for scanner inputthe code should be in java. please use variables for scanner input and also show me the results of the sample inputs.

Implement the following classes: Polygon numSide: int /* constructor */ /* accessor-mutator */ + area (): double + perimeter(): double Triangle sideA: double sideB: double sidec: double * constructor */ /* accessor-mutator */ + area(): double + perimeter(): double Create an object for Triangle class and invoke area and perimeter method. Input Format Take triangle sides (sideA, sideB, sideC) as input from user. Constraints For Triangle, sideB+side > sideA Heron's Formula Area of a Triangle from Sides You can calculate the area of a triangle if you know the lengths of all three sides, using a formula that has been known for nearly 2000 years. It is called "Heron's Formula" after Hero of Alexandria (see below) Just use this two step process: Step 1: Calculate "s" (half of the trangles perimeter): a+b+c S = c Step 2: Then calculate the Area: A=/s(s-a) (s - b) ( sc) Output Format Print Triangle area and perimeter as shown in sample output. Sample Input o 24 30 18 Sample Output o 216.00 72.00 Explanation 0 Here, sideA = 24.00 sideB 30.00 sideC - 18.00 Triangle Area - 216.08 Triangle Perimeter = 72.00 Sample Input 1 54 105 45 Sample Output 1 INVALID Explanation 1 The Triangle inequality Theorem states that the sum of any 2 sides of a triangle must be greater than the measure of the third side. Note: This rule must be satisfied for all 3 conditions of the sides

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!