subject

Write an inheritance hierarchy for classes Quadrilateral, Parallelogram, Rectangle, and Square. JAVA CODE Use Quadrilateral as the superclass of the hierarchy. Create and use a Point class to represent the points in each shape. Make the hierarchy as deep as possible, i. e. more than two levels. Specify the instance variables and methods for each class. The private instance variables of Quadrilateral should be the x-y coordinate pairs for the four endpoints of the Quadrilateral. A program that instantiates objects of your classes and outputs each object's area (except Quadrilateral) has been provided.
the code provided
public class QuadrilateralTest {
public static void main(String[] args) {
// NOTE: All coordinates are assumed to form the proper shapes
// A quadrilateral is a four-sided polygon
Quadrilateral quadrilateral =
new Quadrilateral(1.1, 1.2, 6.6, 2.8, 6.2, 9.9, 2.2, 7.4);
// A parallelogram is a quadrilateral with opposite sides parallel
Parallelogram parallelogram =
new Parallelogram(5.0, 5.0, 11.0, 5.0, 12.0, 20.0, 6.0, 20.0);
// A rectangle is an equiangular parallelogram
Rectangle rectangle =
new Rectangle(17.0, 14.0, 30.0, 14.0, 30.0, 28.0, 17.0, 28.0);
// A square is an equiangular and equilateral parallelogram
Square square =
new Square(4.0, 0.0, 8.0, 0.0, 8.0, 4.0, 4.0, 4.0);
System. out. printf(
"%s %s %s %s\n", quadrilateral, parallelogram,
rectangle, square);
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
For all machines-not just hammers- the user applies force force to the machine to the machine over a certain distance. a. input b. output c. duo d. none of the above
Answers: 1
question
Computers and Technology, 22.06.2019 15:00
Hyperactive media sales has 10 windows 7 laptop computers used by sales-people in the organization. each laptop computer has several customized applications that are used during the sales process as well as customer relationship management software. all of the applications on the laptops are difficult to configure and have large data files. if all of the laptops have current hardware, what is the easiest way to install windows 10 on them?
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 3
question
Computers and Technology, 22.06.2019 22:00
What is a distinguishing feature of today’s graphic application software?) graphic applications are used today on a variety of devices, including touch-screen kiosks and mobile phones.
Answers: 3
You know the right answer?
Write an inheritance hierarchy for classes Quadrilateral, Parallelogram, Rectangle, and Square. JAVA...
Questions
Questions on the website: 13722360