Answered step by step
Verified Expert Solution
Question
1 Approved Answer
help me with the following questions J Shape.java X Square.java D Rectangle.java Using Shapes.java J Shape.java D Square.java Rectangle.java X J UsingShapes.java package midtermQuestion1; package
help me with the following questions
J Shape.java X Square.java D Rectangle.java Using Shapes.java J Shape.java D Square.java Rectangle.java X J UsingShapes.java package midtermQuestion1; package midtermQuestion1; public class Shape { UIAWNG public class Rectangle extends Shape { IOUIAWNG protected int area; private int length, width; protected int perimeter; 60 public Rectangle (int length, int width) { 70 public Shape ( ) { 7 this. length = length; area = 0; 8 this . width = width; perimeter = 0; 10 10 11 110 public void changeShapeParameters (int len, int wid) { 120 public String displayShape( ) { 12 length = len; 13 return "area = " + area + " perimeter " + perimeter; 13 width = wid; 14 14 15 15 160 public void changeShapeParameters ( ) { 160 public void calcAreaPerimeter() { 17 17 area = length * width; 18 18 perimeter = 2 * ( length + width); 190 public void calcAreaPerimeter( ) { 19 } 20 area = 0; 20 21 perimeter = 0; 22 23 J Shape.java D Square.java J Rectangle.java D UsingShapes.java X 1 package midtermQuestion1; UN J Shape.java J Square.java X J Rectangle.java UsingShapes.java public class UsingShapes { package midtermQuestion1; 40 public static void main (String args ) { 5 Shape sh = new Shape [3] ; UIAWNG public class Square extends Shape { private int sideLength; 7 sh [0] = new Shape ( ) ; 8 sh [1] = new Square (10) ; public Square(int sl) { 9 sh [2] = new Rectangle(10, 5); sideLength = sl; 10 8 } 11 for (int i = 0; iStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started