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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:40, rakanmadi87
Solve the following javafx application: write a javafx application that analyzes a word. the user would type the word in a text field, and the application provides three buttons for the following: - one button, when clicked, displays the length of the word.- another button, when clicked, displays the number of vowels in the word.- another button, when clicked, displays the number of uppercase letters in the word(use the gridpane or hbox and vbox to organize the gui controls).
Answers: 1
image
Computers and Technology, 24.06.2019 15:00, dummynate
Universal windows platform is designed for which windows 10 version?
Answers: 1
image
Computers and Technology, 24.06.2019 20:50, cookie1701
Which key function of a business involves finding, targeting, attracting, and connecting with the right customers?
Answers: 3
image
Computers and Technology, 25.06.2019 08:00, india73
When date is processed into a meaningful form, i becomes
Answers: 1
You know the right answer?
Write an inheritance hierarchy for classes Quadrilateral, Parallelogram, Rectangle, and Square. JAVA...

Questions in other subjects:

Konu
Mathematics, 23.12.2019 06:31
Konu
Chemistry, 23.12.2019 06:31