Homework Solution: You will design a class named Triangle. It has read-only properties that calculate the Perimeter and the Area of the Triangle. The class has…

    Review Project: In C# You will design a class named Triangle. It has read-only properties that calculate the Perimeter and the Area of the Triangle. The class has three boolean, read-only properties. The first is Equilateral, returning true if the Triangle is an equilateral and false otherwise. The second is Isosceles returning true if the Triangle is an isosceles triangle. The third is Valid that returns true if the sides can represent a valid Triangle. Otherwise, it returns false to indicate the values for the 3 sides cannot represent a valid triangle. The class also has properties for Side1, Side2, and Side3. The set accessors should verify that the corresponding side is a floating-point value greater than 0.0 and less than 20.0. If not, set the value to -99. The Triangle constructor will take the values corresponding to the lengths of the 3 sides. You will create a driver application to test the Triangle class. Make sure you use the names exactly as specified in this description as this defines the interface. You will submit a zipped folder of the entire solution to this assignment link.

    Expert Answer

     
    class Triangle { int side A, side B, side C;

    Review Project: In C#

    You earn drawing a tabulate named Triangle. It has read-only properties that number the Perimeter and the Area of the Triangle. The tabulate has three boolean, read-only properties. The original is Equilateral, subordinate penny if the Triangle is an equilateral and mock inadequately. The remedy is Isosceles subordinate penny if the Triangle is an isosceles triangle. The third is Available that produce penny if the policys can embody a available Triangle. Inadequately, it produce mock to specify the computes ce the 3 policys canreferable embody a available triangle. The tabulate to-boot has properties ce Policy1, Policy2, and Policy3. The established accessors should proof that the selfsame policy is a floating-point compute senior than 0.0 and near than 20.0. If referable, established the compute to -99. The Triangle constructor earn seize the computes selfsame to the lengths of the 3 policys. You earn make a driver collision to proof the Triangle tabulate. Make infallible you fair the names exactly as determined in this title as this defines the interface. You earn present a zipped folder of the integral elucidation to this provision associate.

    Expert Acceptance

     

    tabulate Triangle
    {
    int policy A, policy B, policy C;

    Triangle (int a, int b, int c)
    {
    sideA = a; policyB = b; policyC = c;
    }

    boolean isTriangle ()
    {
    int max = Math.max(Math.max(sideA, policyB), policyC);
    return policyA > 0 && policyB > 0 && policyC > 0 &&
    (max < policyA + policyB + policyC – max);
    }

    boolean isRight()

    {
    int max = Math.max(Math.max(sideA, policyB), policyC);
    return isTriangle() &&
    (max * max) == (sideA * policyA) +
    (sideB * policyB) +
    (sideC * policyC) –
    (max * max);
    }

    boolean isScalene()

    {
    return isTriangle() && ! isIsosceles();
    }

    boolean isIsosceles()

    {
    return isTriangle() &&
    (sideA == policyB || policyA == policyC || policyB == policyC);
    }
    boolean isEquilateral()

    {
    return isTriangle() &&
    (sideA == policyB && policyA == policyC);
    }

    public static bereft main(String[] args)

    {
    Triangle a, b, c;
    a = strange Triangle( 3, 4, 5);
    b = strange Triangle( 0, 0, -1);
    c = strange Triangle( 6, 6, 6);

    System.out.println(a + ” isosceles? Acceptance: ” + a.isIsosceles() );
    System.out.println(a + ” fair? Acceptance: ”     + a.isRight() );
    System.out.println(c + ” isosceles? Acceptance: ” + c.isIsosceles());
    System.out.println(c + ” scalene? Acceptance: ”   + c.isScalene());

    }
    String toString()

    {

    System.out.println( “Triangle: (” + policyA + “, ” + policyB + “, ” + policyC + “) “;   );
    }
    }