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, 23.06.2019 23:30
The keyboard usually has six rows of keys. which of the following is not one of the key group categories? letter keys number keys control keys graphic keys
Answers: 1
question
Computers and Technology, 24.06.2019 18:50
Write a program that reads in a series of lines of input character by character (using the library function the first line of the input contains an integer which specifies the number of remaining lines of input, each of which contains a floating point number. the integer value on the first line can be read with (the library function) but all of the following lines can only be read with each line, after the first, contains a single floating point value, with up to four digits before the decimal point, and up to four digits following the decimal point, but there is not necessarily a decimal point in each number; i.e., it may appear to be an integer, but the digits should be read by your program, and the number should be converted to a corresponding floating point number. for instance, suppose the following input: 5 3.1255 20.25 0.875 1921.50 31 the required output is: − each of the input floating point values, printed on a separate line with four digits of precision, using printf(); − on the last line of the output, the string “total: ” followed by the sum of the input values, printed with printf() to 4 digits of precision. for example, the total of the sample input given above is 1976.7505, so the required output for this input would be: 3.1255 20.2500 0.8750 1921.5000 31.0000 total: 1976.7505 do not concern yourself with small differences in the total due to rounding, as the grader will not deduct points for this. constraints: − you are not allowed to use arrays on this portion of the lab assignment. − there is no maximum number of lines allowable. it all depends upon the first value of input. since you aren’t saving anything, it doesn’t matter. − you can assume that input will not contain more than 4 digits before or after the decimal point. you do not need to error check for this condition. -you must use getchar() to read in the floating point values one character at a time (i.e. do not use -you must declare and use your floating point values as a double to minimize rounding errors. -only use printf() to output the floating point numbers and the total (do not use − be sure your directions to the user are clear so they are sure to enter the input data correctly.
Answers: 1
question
Computers and Technology, 25.06.2019 04:40
1. instructions: in your response, make an argument for whether for whether it is better for waketown to build its new wake heights subdivision or to preserve the wake wetlan to preserve the wake wetland preserve. use evidence from at least two of the sources below to support your claim. be sure to introduce your precise claim, develop the claim with evidence from the sources, and demonstrate relationships between ideas. (15 points)
Answers: 2
question
Computers and Technology, 25.06.2019 08:10
Java and c++ are examples of languagehigh-level languagesmachine languagecompiler languages
Answers: 1
You know the right answer?
Write an inheritance hierarchy for classes Quadrilateral, Parallelogram, Rectangle, and Square. JAVA...
Questions
question
Advanced Placement (AP), 24.07.2019 07:50
question
History, 24.07.2019 07:50