Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1) Write a program that defines a Shape class with a constructor that gives value to x(width) and y(height). Create two child classes triangle and
1) Write a program that defines a Shape class with a constructor that gives value to x(width) and y(height). Create two child classes triangle and rectangle, that calculate the area of the shape (Name of the function should be area) In the main, define two variables a triangle and a rectangle and then call the area) function fo rwidth-10 and height-20 in this two variables
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started