1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nat2105 [25]
3 years ago
14

Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as t

he superclass of the hierarchy. Create and use a Point class to represent the points in each shape. Make the hierarchy as deep (i.e., as many levels) as possible. 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. Write a program that instantiates objects of your classes and outputs each object‟s area (except Quadrilateral​
Computers and Technology
1 answer:
Ymorist [56]3 years ago
7 0

Answer:

CODE:

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);

}

}

RESULT:

Coordinates of Quadrilateral are:

2 (1.1, 1.2), (6.6, 2.8), (6.2, 9.9), (2.2, 7.4)

3  

4 Coordinates of Parallelogram are:

5 (5.0, 5.0), (11.0, 5.0), (12.0, 20.0), (6.0, 20.0)

6 Width is: 6.0

7 Height is: 15.0

8 Area is: 90.0

9  

10 Coordinates of Rectangle are:

11 (17.0, 14.0), (30.0, 14.0), (30.0, 28.0), (17.0, 28.0)

12 Width is: 13.0

13 Height is: 14.0

14 Area is: 182.0

15  

16 Coordinates of Square are:

17 (4.0, 0.0), (8.0, 0.0), (8.0, 4.0), (4.0, 4.0)

18 Side is: 4.0

19 Area is: 16.0

Explanation:

You might be interested in
Name any two objectives of a business​
olga nikolaevna [1]

Explanation:

Growth – Another important objective of business is to achieve growth. The growth should be in terms of increase in profit, revenue, capacity, number of employees and employee prosperity, etc.

Stability – Stability means continuity of business. An enterprise or business should achieve stability in terms of customer satisfaction, creditworthiness, employee satisfaction etc. A stable organization can easily handle changing dynamics of markets.

6 0
3 years ago
Which of the following is a benifit of googling yourself ?
finlep [7]

Answer:

you are protecting yourself from identity theft

6 0
2 years ago
Can i stream videos from my phone to my android tv
OLEGan [10]
Yes, if you purchase an adapter that you plug into your phone that goes to the hdmi port on the tv. Hope this answered your question- eagle.
4 0
3 years ago
Which programming language's program structure is similar to its syntax?
sashaice [31]

Answer:

I believe it is java.

Explanation:

8 0
3 years ago
Rows are typically represented by _______ and contain data for individual records
Agata [3.3K]
Records, data and tables are terns used in database software.Rows are typically presented by numbers and contain data for individual records. Records are used in database software to organize data. They are stored in tables.
4 0
4 years ago
Other questions:
  • c++ design a class named myinteger which models integers. interesting properties of the value can be determined. include these m
    14·1 answer
  • A video game character prefers to take enemies on from a distance. What skills might such a character have?
    11·2 answers
  • What features are provided by most GUIs?
    7·1 answer
  • When you tap or click the ____ button for a selected graphic, Word provides options for changing how a graphic is positioned wit
    5·1 answer
  • arlos, an algebra teacher, is creating a series of PowerPoint presentations to use during class lectures. After writing, formatt
    12·2 answers
  • you are configuring a firewall to all access to a server hosted in the demilitarized zone of your network. You open IP ports 80,
    7·1 answer
  • What was the first e-commerce service
    13·1 answer
  • Write down the result of each expression in the output column and specify the datatype of the result.Datatype should follow the
    14·1 answer
  • Write a sub-program to display the acceleration of car. The program should ask initial velocity, final velocity, and time taken
    10·1 answer
  • Which coding manual contains three to seven character codes with a decimal after the third character
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!