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
A ____ operating system should be capable of supporting the applications and tools necessary to support Internet operations.
sp2606 [1]

Answer:

Option b is the correct answer for the above question.

Explanation:

A network operating system is an operating system that operates the functions of the network. It is designed to troubleshoot the host and detects the host where it lies in the network. The main function of the network operating system is to operate the network. The above question asked about the term which is used to operate the network. Then the answer is the network operating system which is stated from option b. Hence option b is the correct answer while the other is not because--

  • Option 'a' states about print which is the option to print the statement.
  • Option c states about the file which is used for storage purpose.
  • Option d states about the memory which is used for storage purpose.

8 0
3 years ago
A security administrator is required to submit a new csr to a ca. what is the first step?
m_a_m_a [10]
If an administrator needs to renew a certificate for a web server he/she should submit the CSR (Certificate Signing Request) to CA.
<span>If a security administrator is required to submit a new CSR to a CA, teh fisrt step the administrator should do is to g</span>enerate a new private key based on RSA.
4 0
3 years ago
Why is there no ide length or timing for study breaks?​
Ghella [55]

Answer:

Could you add more to ur question?

4 0
3 years ago
Write a program that reads 20 integers from the user into an array and uses a function arrayMinimum that accepts an integer arra
neonofarm [45]

Answer:

#include <iostream>

using namespace std;

int arrayMinimum(int myArray[], int myArraySize) {

int small = myArray[0];

for (int i = 0; i < myArraySize; i++) {

   if(myArray[i]<small){

small = myArray[i];

}

 }

 return small;

}

int main(){

   int myArray[20];

   for(int i =0;i<20;i++){

       cin>>myArray[i];          

   }

   cout<<"The smallest is: "<<arrayMinimum (myArray,20);

   return 0;

}

Explanation:

This solution is provided in c++

#include <iostream>

using namespace std;

This line defines the arrayMinimum function

int arrayMinimum(int myArray[], int myArraySize) {

This initializes the smallest of the array element to the first

int small = myArray[0];

This iterates through the array

for (int i = 0; i < myArraySize; i++) {

This if condition checks for the smallest

   if(myArray[i]<small){

The smallest is assigned to the small variable

small = myArray[i];

}

 }

This returns the smallest

 return small;

}

The main method begins here

int main(){

This declares an array of 20 elements

   int myArray[20];

The following iteration allows user input into the array

<em>    for(int i =0;i<20;i++){ </em>

<em>        cin>>myArray[i];          </em>

<em>    } </em>

This calls the method and returns the minimum

   cout<<"The smallest is: "<<arrayMinimum (myArray,20);

   return 0;

}

6 0
2 years ago
Which option best explains the goal of computer science?
skad [1K]

Answer:

B correct answer b i think so

8 0
3 years ago
Other questions:
  • Define a function CoordTransform() that transforms its first two input parameters xVal and yVal into two output parameters xValN
    7·2 answers
  • What are three steps to use to research relevant information on the internet? (Site 1)
    13·2 answers
  • On which of the following pointing devices can you control the pointer by sliding your fingertip?
    11·1 answer
  • How to wire two separate switches &amp; lights using the same power source?
    14·1 answer
  • What is the best way to locate where my C program gets into an infinite loop
    5·1 answer
  • A website's ____ page provides basic information about the individual or organization and includes a navigation bar with links t
    13·1 answer
  • Why is it so important to adhere to principles that have been put forth by reputable organizations to ensure that you are mainta
    10·1 answer
  • Why do we need to learn about engineering and technology?
    6·1 answer
  • Which of the following is true of lossy and lossless compression techniques?
    13·1 answer
  • The principle of ________ strongly suggests that programs should execute with the least amount of privileges needed to complete
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!