In C++ design a class named Triangle that extends GeometricObject. The class contains the following: Three double data fields named side1, side2, and side3 to denote three sides of the triangle. A no-arg constructor that creates a default triangle with each side 1.0. A constructor that creates a rectangle with the specified side1, side2, and side3. The constant accessor functions for all three data fields. A constant function named getArea() that returns the area of this triangle. A constant function named getPerimeter() that returns the perimeter of this triangle. Submit the following: Draw the UML diagram that involves the classes Triangle and GeometricObject. Implement the class. 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. The program should create a Triangle object with these sides and set the color and filled properties using the input. The program should display the area, perimeter, color, and true or false to indicate whether filled or not.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 2CP
icon
Related questions
Question
100%

In C++ design a class named Triangle that extends GeometricObject. The class contains the following:

  • Three double data fields named side1side2, and side3 to denote three sides of the triangle.
  • A no-arg constructor that creates a default triangle with each side 1.0.
  • A constructor that creates a rectangle with the specified side1side2, and side3.
  • The constant accessor functions for all three data fields.
  • A constant function named getArea() that returns the area of this triangle.
  • A constant function named getPerimeter() that returns the perimeter of this triangle.

Submit the following:

  1. Draw the UML diagram that involves the classes Triangle and GeometricObject.
  2. Implement the class.
  3. 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. The program should create a Triangle object with these sides and set the color and filled properties using the input. The program should display the area, perimeter, color, and true or false to indicate whether filled or not.
 
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
JQuery and Javascript
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT