Question: omplete a properly encapsulated class named Shape, which has the following: A boolean instance variable named is Filled. A String instance variable named color. A

 omplete a properly encapsulated class named Shape, which has the following:
A boolean instance variable named is Filled. A String instance variable named
color. A default, no-arg constructor which sets isFilled to true, and color
to "Green". - An overloaded constructor which takes two parameters, a boolean

omplete a properly encapsulated class named Shape, which has the following: A boolean instance variable named is Filled. A String instance variable named color. A default, no-arg constructor which sets isFilled to true, and color to "Green". - An overloaded constructor which takes two parameters, a boolean and a String and sets the instance variables accordingly. An overridden tostring() method, which returns a String. The String should contain: The values of the instance variables in the following format: Filled: true Color: Green Complete a properly encapsulated class named Circle, which inherits from Shape and has the following: A double instance variable named radius. A default, no-arg constructor which sets radius to 1. An overloaded constructor which takes one double parameter and sets the instance variable radius to the value passed in. Another overloaded constructor which takes three parameters, a double for radius, a boolean for isFilled and a String for color, and sets. the instance variables accordingly, Hint:(Invoke the matching constructor from the superdass) 11 - A method named getArea() which calculates and returns the area of the circle. An overridden tostring() method. The returned String should contain: the value of radius, the area of the circle, then the result of calling the tostring() method from the superclass, the return String should be formatted as follows: Radius: 2.67 Area: 22.396099868176275 Filled: true Color: Green ete a properly encapsulated class named Rectangle, which inherits from Shap 5 the following: Two double instance variable named width and length. A default, no-arg constructor which sets length to 2 and width to 1. An overloaded constructor which takes two double parameter and sets the instance variables width and length to the values passed in. Another overloaded constructor which takes four parameters, a double for width, a double for length, a boolean for isFilled and a String for color, and sets the instance variables accordingly, Hint:(invoke the matching constructor from the superclass)!! - Note that a rectangle has a length that is always greater than width. A void setLW() method which takes two parameters x and y, and set the length instance variable to the largest value passed in and the width instance variable to the smallest value passed in (Assume that x and y are always positive and have different values), also call this method in the constructors, so your instance variables will always have legal values. - A method named getArea() which calculates and returns the area of the rectangle. - An overridden tostring() method. The returned String should contain: The value of the length, the value of the width, the area of the rectangle, then the result of calling the tostring() method from the superclass, the return String should be formatted as follows: Width: 3.2 Length: 4.0 Area: 12.8 Filled: false Color: Red If you implemented your classes correctly, the output should match the follows

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!