Question: 1. Write a superclass called Shape, which contains: Two instance variables color (String) and filled (boolean). Two constructors: a no-argument constructor that initializes the color

 1. Write a superclass called Shape, which contains: Two instance variables

1. Write a superclass called Shape, which contains: Two instance variables color (String) and filled (boolean). Two constructors: a no-argument constructor that initializes the color to "green" and filled to true, and a constructor that initializes the color and filled to the given values. Getter and setter for all the instance variables. A toString() method that returns "A Shape with color of xxx and filled/Not filled". Write a test program to test all the methods defined in Shape. Write a subclasses of Shape called Circle which contains: (i) An instance variable radius (double). (ii) Three constructors as given below. The no-arg constructor initializes the radius to 1.0. A constructor that initializes the radius to the given values. A constructor that initializes the radius, color and filled to the given values. (iii) Getter and setter for the instance variable radius. (iv) Methods get Area() and get Perimeter(). (v) Override the toString() method inherited, to return "A Circle with radius=xxx, color of xxx and filled/Not filled

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!