Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Exercise Design a class named Triangle that extends Geometricobject. Please add the Triangle class definition in the file Triangle.h and add the implementation in

image text in transcribed
Lab Exercise Design a class named Triangle that extends Geometricobject. Please add the Triangle class definition in the file Triangle.h and add the implementation in the file Triangle.cpp. The class contains the following: . Three double data fields named side1, side2, and side3 to denote three sides of the triangle . A default constructor that creates a default triangle with each side 1.0. . A constructor that creates a triangle with the specified side1, side2, and side3. A constructor that creates a triangle with the specified sidel, side2, and side3, color, and filled. . The accessor functions for all three data fields. . A function named get_perimeter) that returns the perimeter of this triangle. Implement the class Triangle. Write a test program that * prompts the user to enter three sides of the triangle, enter a color, and enter 1 or 0 to indicate whether the triangle is filled creates a Triangle object with these sides and set the color and filled properties using the input. * displays the perimeter, color, and true or false to indicate whether filled or not. The expected result: Please enter the three sides: 6 6 6 Please enter the color: blue Is the triangle filled (1: filled, 0: not filled): 1 The perimeter of the triangle is: 18 The color of the triangle is: blue Is the triangle filled? true Compile gtt -c Triangle.cpp gt+ -c lab08.cpp g++ Triangle.o lab08.o - lab08 /lab8 Hand In Triangle.h: the header file containing the Triangle class and Geometricobject class. * Triangle.cpp: the implementation file containing the implementation of Triangle class and Geometricobject class. . lab08.cpp: the client test file containing main) funcion. * lab08result: the script file which captures the result. Yan Zhang

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

More Books

Students also viewed these Databases questions

Question

=+Who are they?

Answered: 1 week ago