Question: c++ UNIC 3. Write a class named Triangle to represent a Triangle. The class contains: Two double data fields named base and height that specify

c++
c++ UNIC 3. Write a class named Triangle to represent a Triangle.

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)

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!