Question: 1. 2. 3. A parent class named 'Pen' has a single constructor with a parameter of the Color data type. Pen has a public getter

1.1. 2. 3. A parent class named 'Pen' has a single constructor

2. with a parameter of the Color data type. Pen has a public3. getter for the pen color named 'getColor. A child class name 'RedPen'

A parent class named 'Pen' has a single constructor with a parameter of the Color data type. Pen has a public getter for the pen color named 'getColor. A child class name 'RedPen' sets the color field of Pen to Color.RED in the constructor and has no 'getColor' method. You instantiate 'RedPen, naming the object 'myPen'. Write the complete statement that gets the color of myPen and stores it in a new Color object variable named penColor. Use proper spacing per the course style guide. Do not include additional spaces at the beginning or end. You have a subclass named 'FancyPen' that extends the superclass 'Pen. Both Pen and FancyPen havea public method named 'getFont' which has no parameters and returns an object of the Font class. Fill in the blank to complete a method in FancyPen named 'getDefaultFont' that passes the parent class's font value to the caller. public Font getDefaultFont) t A parent class named 'Pen' has a single constructor with a parameter of the Color data type. You are extending the Pen class to include an int 'width' field with a new class named VariableWidthPen' Fill in the blank to complete the constructor for VariableWidthPen: public VariablewidthPen (Color color, int width) \ this.width - width; Use proper spacing per the course style guide. Do not include additional spaces at the beginning or end

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!