Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Describe the functions of communication

Answered: 1 week ago

Question

3. What may be the goal of the team?

Answered: 1 week ago

Question

Is how things are said consistent with what is said?

Answered: 1 week ago