Question: Java We have written the following Rectangle class: class Rectangle extends Quadrilateral ( // instance variables private double width; private double height; // constructor public
Java
We have written the following Rectangle class: class Rectangle extends Quadrilateral ( // instance variables private double width; private double height; // constructor public Rectangle( double w, double h) { this.width = w; this.height = h; // instance methods public String getMessage() { return "I am a Rectangle"; public double getArea() { return this.width * this.height; TASK: Create two classes, Quadrilateral and Square, that have the following properties: The Quadrilateral class must be an abstract class. It must declare (but not define) a no-parameter method called getArea that returns a double. It should also define a no-parameter method called getMessage that returns the string "I am a Quadrilateral" The Square class must extend the Rectangle class. It must define a constructor that has one double parameter representing the side length of a square, and the getArea method should return the square of this argument. It should also override the getMessage instance method to return the string "I am a Square
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
