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]
2 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]2 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
Which term refers to a cloud-native, streamlined technology for hosting cloud-based applications, where a server runs for short
PilotLPTM [1.2K]

Answer:

Serverless computing.

Explanation:

Cloud computing can be defined as a type of computing that requires shared computing resources such as cloud storage (data storage), servers, computer power, and software over the internet rather than local servers and hard drives.

Generally, cloud computing offers individuals and businesses a fast, effective and efficient way of providing services.

Cloud computing comprises of three (3) service models and these are;

1. Platform as a Service (PaaS).

2. Infrastructure as a Service (IaaS).

3. Software as a Service (SaaS).

The three (3) main characteristics of cloud computing are;

I. Measured service: it allows cloud service providers to monitor and measure the level of service used by various clients with respect to subscriptions.

II. Resource pooling: this allows cloud service providers to serve multiple customers or clients with services that are scalable and provisional.

III. Elasticity: this is the ability of the cloud computing service to be flexible and adaptive to the traffic or requests from the end users.

Serverless computing is a term which refers to a cloud-native and streamlined technology that is designed typically for hosting cloud-based applications, in which a server operates for short bursts only when needed by an application or service. Serverless computing is used for the allocation of machine resources on demand.

8 0
2 years ago
Here is the API for a robot library. // moves the robot forward function moveForward(); // turns the robot to the left function
kupik [55]

Answer:

Option (A)

Explanation:

See attachment for options

From the options, the code segment of option (A) answers the question and the explanation is as follows:

I added a second attachment which illustrates the movement

function (solveMaze) {

moveForward(); ---- The robot moves up (to position 1)

moveForward(); ---- The robot moves up (to position 2)

rotateRight(); ---- The robot changes where it faces (however, it is still at position 2)

<em>while(canMove("forward")) { moveForward(); } </em>---- This is repeated until the robot reaches the end of the grid (i.e. position 3 and 4)

rotateLeft(); ---- The robot changes where it faces (however, it is still at position 4)

moveForward(); ---- The robot moves up to the gray square

5 0
3 years ago
The operation of early electronic computing devices required:
Harrizon [31]

Answer:

c

Explanation:

5 0
3 years ago
Which of the following is not a method of the history object?
Volgvan

Answer:

replace()

Explanation:

The history object in javascript corresponds to browsing history.

It has the following methods for navigating through the history list:

back(): Go back in the history list

forward(): Go forward in the history list

go() : Navigate to the currently pointed url in the history list. It takes a parameter which can either be a numeric index or a string which is matched with the history list content.

replace() is not a method in the history object.

7 0
2 years ago
Select all that apply.
Nady [450]
1 and 2 since it says does not
5 0
3 years ago
Read 2 more answers
Other questions:
  • What is the difference between a syntax error and a logical error?
    15·1 answer
  • In addition to the ping command, what other command is useful in displaying network delay and breaks in the path to the destinat
    5·2 answers
  • Mike needs to write the primary objectives of a project in a project plan. In which section should he write them?
    6·1 answer
  • Sam's take-home pay is $743. His deductions are $25 for OASDI, $5 for Medicare, and $27 for income tax. What is his gross pay? A
    14·1 answer
  • Dam naj za pierwszej osobie która odpowie dobrze!
    13·1 answer
  • Write an If/else statement to check whether host is online. If it is online, then print system is online otherwise print system
    13·1 answer
  • Which Internet connection type tends to use shared bandwidth?<br> Cable<br> Dial-up<br> DSL<br> ISDN
    5·2 answers
  • What are some of the opportunities that the stem program offers?
    15·1 answer
  • A user has multiple web pages open and is using email. Which layer of the Transmission Control Protocol/Internet Protocol (TCP/I
    7·1 answer
  • Which data type is used to teach a Machine Learning (ML) algorithm during structured learning?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!