Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help writing this program in c ++ Here's the UML class diagram that matches these specifications without all of the required getters and setters:

image text in transcribed

Need help writing this program in c ++

image text in transcribed

Here's the UML class diagram that matches these specifications without all of the required getters and setters: - Has the following "protected" attributes: - height \#represents the height of the shape - width \#represents the width of the shape - Has the following methods: - show_dimensions \#prints out the height and width of the shape to_String \#returns a string description of the shape - Has the following Virtual methods: - getArea() getPerimeter() - Has 2 constructors - Shape() // sets both height and width to 0 - Shape(double ht, double wd) // sets height to ht, width to wd Write a Class for a Triangle that implements Shape (derived from Shape) - Has the following attributes in addition to those from Shape: style \#like right or isosceles - Has the following methods: - Any necessary getters/setters - appropriate constructors - getPerimeter() - just return a constant value - 2 constructors - Triangle() // implements Shape() - Triangle (double h, double b, string s) // sets height, base and style Write a Class for a Rectangle that implements Shape (derived from Shape) - Has the following attributes: square \#boolean when true is square, when false is rectangle - Has the following methods: - Any necessary getters/setters (including overriding those from Shape if necessary) - appropriate constructors - Has 2 constructors - Rectangle() // implements Shape() - Rectangle(double h, double w) // sets height, width and whether square or not Write a tester program that - Instantiates as many Triangles and Rectangles as you need to test all of the Constructors and methods of the Triangle and Rectangle classes - Test all of the Constructors and Methods for Triangle, Rectangle and Shape

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

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

LO1 Summarize the organizations strategic planning process.

Answered: 1 week ago