Menu

Unic 3 Write Class Named Triangle Represent Triangle Class Contains Two Double Data Fields Q43889259

c++
UNIC 3. Write a class named Triangle to represent a Triangle. The class contains: • Two double data fields named base and heiUNIC 3. Write a class named Triangle to represent a Triangle. The class contains: • Two double data fields named base and height that specify the base and height of the triangle. • A constructor with no arguments that creates a triangle with width 3 and height 2. A constructor that creates a default triangle with the specified by the user width and height. • The accessor (get) and mutator (set) functions for all the data fields. • A function named getArea() that returns the area of this triangle. Write a test program that creates two Triangle objects. Assign base 4 and height 3 to the first object and base 5 and height 8 to the second. Display the properties of both objects and find their areas. (15 points) Show transcribed image text UNIC 3. Write a class named Triangle to represent a Triangle. The class contains: • Two double data fields named base and height that specify the base and height of the triangle. • A constructor with no arguments that creates a triangle with width 3 and height 2. A constructor that creates a default triangle with the specified by the user width and height. • The accessor (get) and mutator (set) functions for all the data fields. • A function named getArea() that returns the area of this triangle. Write a test program that creates two Triangle objects. Assign base 4 and height 3 to the first object and base 5 and height 8 to the second. Display the properties of both objects and find their areas. (15 points)

Expert Answer


Answer to UNIC 3. Write a class named Triangle to represent a Triangle. The class contains: • Two double data fields named base …

OR