Question: I want the code in java Create a class called Shape with a protected data member called width. The class will have the following member

 I want the code in java Create a class called Shape

I want the code in java

Create a class called Shape with a protected data member called width. The class will have the following member functions: - Default constructor that set the value to 0 . - A constructor to accept the value. - Display the data member. Create 2 classes that inherit from the class Shape called Square and Rectangle. Class Rectangle had a data member called length. Both the class will have the following data members: - Default constructor that set the value to 0 . - A constructor to accept the value. - Insert values into the shapes - Display the data members. - Calculate and return the area of the shapes - Calculate and return the perimeter of the shapes You are required to write a program to demonstrate the above class and member functions

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!