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
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
Get step-by-step solutions from verified subject matter experts
