Define a class named ny454590Triangle which represents a special right triangle. A 45 45 90 triangle is a special type of isosceles right triangle where the two legs are congruent to one another and the non-right angles are both equal to 45 degrees. The ratio of the sides to the hypotenuse is always 1:1:square root of two. The y45-4590Triangle class contains the following: A private double data field named al del which defines the side a of a triangle. The default value is 10. A default (or "no-argument" or "no-arg) constructor that constructs a y-45-4590Triangle object using default values. • An overloaded constructor that constructs ay-45-4590Triangle object with the given side. A method named getsidek() which returns the side of a 45 45 90 triangle. • A method named getside() which returns the side of a 45 45 90 triangle A method named getsidec() which returns the sideC (e. hypotenuse) of a 45 45 90 triangle A method named toString() that returns a string description of the triangle in the format "My454590 Triangle(side, side, side). Write the By-45-4590Triangle class in the answer box below. Note-keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test my454590Triangle = new my454500riangle(); System.out.println(); System.out.println(11.getSide()); System.out.println(t.get(); System.out.printf("%.2f", t.getide()); Result System.out.println(); System.out.println(pl - p2); my454500Triangle(10.00, 10.00, 14.14) 10.0 my454590Triangle pl new my454500riangle(2.5); my454590Triangle p2new my454590Triangle(2.5); false my454500triangle: (2.50, 2.50, 3.54)

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 2E
icon
Related questions
Question
Define a class named 45-4590Triangle which represents a special right triangle. A 45 45 90 triangle is a special type of isosceles right triangle where
the two legs are congruent to one another and the non-right angles are both equal to 45 degrees. The ratio of the sides to the hypotenuse is always
1:1:square root of two. The My45-4590Triangle class contains the following:
• A private double data field named sided which defines the side a of a triangle. The default value is 10.
• A default (or "no-argument" or "no-arg") constructor that constructs a My454590Triangle object using default values.
• An overloaded constructor that constructs ay454590Triangle object with the given side.
• A method named getsidea() which returns the side
of a 45 45 90 triangle.
• A method named getsides() which returns the side of a 45 45 90 triangle.
• A method named getsidec() which returns the sideC (e. hypotenuse) of a 45 45 90 triangle.
• A method named toString() that returns a string description of the triangle in the format "My454590Triangle (sideA, side, side).
Write the Xy454590Triangle class in the answer box below. Note-keep a copy of your solution to this task because you will be extending it step by
step in subsequent tasks.
For example:
Test
My454590Triangle t1= new My454590Triangle();
System.out.println(t);
System.out.println(ti.getSide());
System.out.println(t.getSide());
Result
System.out.println(p2);
System.out.println( pl -- p2);
my454590Triangle: (10.00, 10.00, 14.14)
10.0
10.0
14.14
System.out.printf("%.2f", t1.getSide());
My454590Triangle p1 new My454590Triangle (2.5); my454590Triangle: (2.50, 2.50, 3.54)
Py454590Triangle p2 new My454590Triangle (2.5); false
Transcribed Image Text:Define a class named 45-4590Triangle which represents a special right triangle. A 45 45 90 triangle is a special type of isosceles right triangle where the two legs are congruent to one another and the non-right angles are both equal to 45 degrees. The ratio of the sides to the hypotenuse is always 1:1:square root of two. The My45-4590Triangle class contains the following: • A private double data field named sided which defines the side a of a triangle. The default value is 10. • A default (or "no-argument" or "no-arg") constructor that constructs a My454590Triangle object using default values. • An overloaded constructor that constructs ay454590Triangle object with the given side. • A method named getsidea() which returns the side of a 45 45 90 triangle. • A method named getsides() which returns the side of a 45 45 90 triangle. • A method named getsidec() which returns the sideC (e. hypotenuse) of a 45 45 90 triangle. • A method named toString() that returns a string description of the triangle in the format "My454590Triangle (sideA, side, side). Write the Xy454590Triangle class in the answer box below. Note-keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test My454590Triangle t1= new My454590Triangle(); System.out.println(t); System.out.println(ti.getSide()); System.out.println(t.getSide()); Result System.out.println(p2); System.out.println( pl -- p2); my454590Triangle: (10.00, 10.00, 14.14) 10.0 10.0 14.14 System.out.printf("%.2f", t1.getSide()); My454590Triangle p1 new My454590Triangle (2.5); my454590Triangle: (2.50, 2.50, 3.54) Py454590Triangle p2 new My454590Triangle (2.5); false
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning