Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

C++
image text in transcribed
UNIC 3. Write a class named Triangle to represent a Triangle. The class contains: 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 .The accessor (get) and mutator (set) functions for all the data fields. height. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions