Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. 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 (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​

Answers

Answer 1

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:

Answer 2

In this exercise we have to use the knowledge of computational language in JAVA, so we have that code is:

It can be found in the attached image.

So, to make it easier, the code in JAVA can be found below:

public class QuadrilateralTest {

public static void main(String[] args) {

new Quadrilateral(1.1, 1.2, 6.6, 2.8, 6.2, 9.9, 2.2, 7.4);

new Parallelogram(5.0, 5.0, 11.0, 5.0, 12.0, 20.0, 6.0, 20.0);

new Rectangle(17.0, 14.0, 30.0, 14.0, 30.0, 28.0, 17.0, 28.0);

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

}

}

See more about JAVA at brainly.com/question/2266606

Write An Inheritance Hierarchy For Classes Quadrilateral, Trapezoid, Parallelogram, Rectangle And Square.

Related Questions

Which validation method would you use for first name on a data form

Answers

Which validation method would you use for first name on a data form

Do you have any concerns or worries about how you will manage your course assignments or expectations? Your journal entry will only be seen by you and your instructor, so feel free to share any questions and worries you have.

Answers

Answer:

no worries at all.

yeah-ya..... right?

30th Nov 2020. Difference between Data and Information

Answers

Answer:

Data is a collection of unstructured or unorganized facts and figures.

Information is a collection of processed data.

Hope it helps...............

Just a quick question, how do you set something == to char and int in an if statement (java)
Write a method checkCharacter() which has 2 parameters: A String, and a specified index (an int). Method checkCharacter() checks the character at the specified index of the String parameter, and returns a String based on the type of character at that location indicating if the character is a letter, digit, whitespace, or unknown character.


Ex: The method calls below with the given arguments will return the following Strings:


checkCharacter("happy birthday", 2) returns "Character 'p' is a letter"

checkCharacter("happy birthday", 5) returns "Character ' ' is a white space"

checkCharacter("happy birthday 2 you", 15) returns "Character '2' is a digit"

checkCharacter("happy birthday!", 14) returns "Character '!' is unknown"


Your program must define the method:

public String checkCharacter(String word, int index)



this is what i got to but im stuck on how to find out if its a char or int


public class TollCalculation {


public double calcToll(int hour, boolean isMorning, boolean isWeekend) {

Scanner scnr = new Scanner(System.in);

int timeHour; // Time of travel hour (24 hour format)

int timeMinute; // Time of travel minute

int inputColon; // Used to read time format

String userInput; // User specified time

double tollAmount;

}


public static void main(String[] args) {

TollCalculation tollObj = new TollCalculation();


// Test the three samples from the specification.

System.out.println(tollObj.calcToll(7, true, false));

System.out.println(tollObj.calcToll(1, false, false));

System.out.println(tollObj.calcToll(3, true, true));

}

}

Answers

This is the requested code in java.

public class CharTest {

   public static String checkCharacter(String text, int index) {

       if (0 <= index && index <= text.length()) {

           char ch = text.charAt(index);

           if (Character.isLetter(ch)) {

               return ch + " is a letter";

           } else if (Character.isDigit(ch)) {

               return ch + " is a digit";

           } else if (Character.isWhitespace(ch)) {

               return ch + " is a whitespace character";

           } else {

               return ch + " is an unknown type of character";

           }

       } else {

           return "index " + index.toString() + " is out of range";

       } // end if

   } // end function checkChar()

   public static void main(String[] args) {

       // Test the three samples from the specification.

       System.out.println(checkCharacter("happy birthday", 2));

       System.out.println(checkCharacter("happy birthday", 5));

       System.out.println(checkCharacter("happy birthday 2 you", 15));

   } // end function main()

} // end class CharTest

The function checkcharacter(text, index) returns a string value describing the kind of character found at the position in text specified by index; whether it was a letter, digit, whitespace, or an unknown kind of character.

How it does that is to make use of respective functions defined within the Character class in java. That is

isLetter(char) returns a bool specifying if the char parameter is a letter.isDigit(char) returns a bool specifying if the char parameter is a digit.isWhitespace(char) returns a bool specifying if the char parameter is a whitespace character.

It calls these functions in an if statement. These else part of the if statement is then executed if the character is neither a letter, digit, or whitespace.

Finally, the function main() calls checkCharacter() three times to test the function and return the results to the console.

Another example of a java program on characters is found in the link below

https://brainly.com/question/15061607

Which device can perform both input and output functions?

Answers

Answer:

For instance, a keyboard or computer mouse is an input device for a computer, while monitors and printers are output devices. Devices for communication between computers, such as modems and network cards, typically perform both input and output operations.

Answer:

Modems and network cards, typically perform both input and output operations

how can computers be a threat to public safety??

help asap marking brainiest ​

Answers

Loss or theft of your computer, smartphone or tablet. Malware, including spyware, on public computers. Theft of personal information from, or access to browsing history on public computers.

What is the grooming process as it relates to online predators

Answers

the process by which online predators lure in minors to get close enough to hurt them.

The system tray contains _____.
A. the battery life
B. the computer's hard drive
C. the operating system
D. Quick Launch

Answers

[tex]⇒[/tex]

the operating system

The notification area (also called the "system tray") is located in the Windows Taskbar, usually at the bottom right corner. It contains miniature icons for easy access to system functions such as antivirus settings, printer, modem, sound volume, battery status, and more.

Answer:

A BATTERY LIFEExplanation: The person said it and it was right I believed them, and they made me get a 100% thank you sir/madam and as you can see, I have proof so your welcome and thank you.

I Wouldn't just say the letter like A or C because everyone's quiz is different, and it changes but either way whatever your welcome and again thank you.

.tag is used to draw a horizontal line

Answers

Answer:

<hr>  tag.

Explanation:

<hr> tag makes a line along the webpage :)

What is primary difference between the header section of a document and the body

Answers

Answer:

A HTML file has headers and a "body" (payload) — just like a HTTP request. The <body> encapsulates the contents of the document, while the <head> part contains meta elements, i.e., information about the contents. This is (typically) title, encoding, author, styling etc.

Explanation:

CAN I GET BRAINLIEST

Why does a computer need an operating system?

Answers

Answer:

An operating system helps it to manage and run its designed duties.

If it lacks an operating system, it wouldn't be able to work

Can someone help me explain Nvm scheduling in operating systems?

Answers

Low-power and short-latency memory access is critical to the performance of chip multiprocessor (CMP) system devices, especially to bridge the performance gap between memory and CPU

What are the steps to creating a text box? Use the drop-down menus to complete them.

1. Go to the
View
tab on the ribbon.

2. Click
.

3. Select any of the templates shown or
, which will open a blank text box.

4. Position the text box and adjust the text size, font, and color as desired.

Answers

Answer: The answers (in order) are

Insert

Text Box

Draw Text Box

Explanation: Just took the test on edgen, November 2021.

Choose one piece of information your class can know, but you don’t want to share on your website. Why is it okay for your classmates and teacher to know it, but not to post it publicly?

Answers

Answer:

because other people you dont know can see it and it can sometimes not be good

Explanation:

what are the main barriers to the adoption of an industry standard for internet system

Answers

Answer:

Industry experts say that although many companies find the potential of the Internet of Things very attractive, they either lack a clear value proposition for end-users or lack interoperability.

What is the best data type for nationality field

Answers

Answer:

ISO Alpha-2 (two-letter country code) ISO Alpha-3 (three-letter country code) ISO Numeric (three-digit country code)

HOW TO DISCONNECT A MONITOR FROM A SYSTEM UNIT

Answers

Answer: 1. Use the Windows key + P keyboard shortcut.

2. Using the “Project” flyout, select the PC screen only option.

3. Open Settings.

Click on Display.

Under the “Select and rearrange displays” section, select the monitor that you want to disconnect.

Select monitor on Windows 10

Under the “Multiple displays” section, use the drop-down menu and select the Disconnect this display option.

Describe the two problems that appear in the construction of large programs that led to the development of encapsulation constructs.

Answers

Two problems that can lead to the development of encapsulation constructs when creating large programs are the complexity of data and the lack of security in sensitive data.

We can arrive at this answer because:

Encapsulation constructs are designed to prevent data from being invaded by unauthorized person.These constructions must be done without causing inconsistencies in the system, interfering with codes, and increasing the complexity of data. For this reason, large programs that present high complexity and difficult codes, demand the use of encapsulation constructs, so that their data does not become more complex.Encapsulation constructs are also necessary when there are flaws in data security and it is not possible to keep them away from the attack by intruders.

Although there are other ways to accomplish these goals, encapsulation constructs are widely used because of their simplicity and efficiency.

More information:

https://brainly.com/question/13438419

Without proper synchronization, which is possible, a deadlock, corrupted data, neither or both? Give reasons for your answer.
need answer pls​

Answers

Without proper synchronization, corrupted data is possible due to the fact that a shared datum can be accessible by multiple processes.

Data synchronization simply means the idea of keeping multiple copies of dataset in coherence with one another in order to maintain data integrity. It's the process of having the same data in two or more locations.

Without proper synchronization, corrupted data is possible because a shared datum could be accessed by multiple processes without mutual exclusive access.

Read related link on:

https://brainly.com/question/25640052

What is the best data type for traveling day?

Answers

here if its wrong sorry

Write a function named parts that will take in as parameters the dimensions of the box (length, width, and height) and the radius of the hole, and returns the volume of material remaining. Assume the hole has been drilled along the height direction. Note: first write the function assuming the hole has radius less than min(length/2, width/2). For full credit, you will need to account for larger radii (bigger than half the length or width of the box).

Answers

The function in Python where comments are used to explain each line is as follows:

#This defines the parts() function

def parts(length, width, height, radius):

   #This calculates the volume of the box

   VBox = length * width * height

   #This calculates the volume of the hole

   VHole = 3.142 * radius ** 2 * height

   #This calculates the remaining volume

   Volume =  VBox - VHole

   #This returns the volume of the remaining material

   return Volume

The above program is a sequential program, and it does not require loops, iterations and conditions.

Read more about similar programs at:

https://brainly.com/question/13971394

Write a program, using case statements, that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result. For division, of the denominator is zero, output an appropriate message.

Answers

Answer:#include<iostream>

using namespace std;

int main() {

int var1, var2;

char operation;

cout << "Enter the first number : ";

cin >> var1;

cout << endl;

cout <<"Enter the operation to be perfomed : ";

cin >> operation;

cout << endl;

cout << "Enter the second nuber : ";

cin >> var2;

cout << endl;

bool right_input = false;

if (operation == '+') {

cout << var1 << " " << operation << " " << var2 << " = " << (var1 + var2);

right_input = true;

}

if (operation == '-') {

cout << var1 << " " << operation << " " << var2 << " = " << (var1 - var2);

right_input = true;

}

if (operation == '*') {

cout << var1 << " " << operation << " " << var2 << " = " << (var1 * var2);

right_input = true;

}

if (operation == '/' && var2 != 0) {

cout << var1 << " " << operation << " " << var2 << " = " << (var1 - var2);

right_input = true;

}

if (operation == '/' && var2 == 0) {

cout << "Error. Division by zero.";

right_input = true;

}

if (!right_input) {

cout << var1 << " " << operation << " " << var2 << " = " << "Error;";

cout << "Invalid Operation!";

}

cout << endl;

system("pause");

return 0;

}

Explanation:

the reasons why business processes are necessary in a company

Answers

What is a business process?

Before knowing why they are necessary, let me explain what a business process is to be clear so you can understand a little bit more before I get to the meat. When a group of people work together to accomplish a certain goal, the process is called a "business process." A participant is assigned a task at each step of a business process. To put it another way, it serves as the foundation for several related concepts such as business progress management and process automation

The importance of a business process.

In big firms, having a business process is a must, and the advantages of doing so are immediately apparent. Organizations are made up of processes, which allow them to streamline and maximize the utilization of resources at the same time.

Reasons to have a well-defined business processIdentify which tasks are the most important to your larger business goalsImprove efficiencyStreamline communicationSet approvals to ensure accountability and an optimum use of resourcesPrevent chaos from lurking and lingering in your daily operationsStandardize a set of procedures to complete tasks that really matter to your business and tie it togetherReduction of risks from BPM softwareElimination of redundanciesMinimized costsImproved collaborationImproved productivity so that means more moneyHigher efficiencyHigher compliance

Answer:

Key reasons to have well-defined business processes

Identify what tasks are important to your larger business goals. Improve efficiency. Streamline communication between people/functions/departments. Set approvals to ensure accountability and an optimum use of resources.

In order to send and receive packets in the Internet, hosts require an IP address. What are the 2 ways a host can obtain an IP address

Answers

Answer:

Explanation:

An IP address is a 32-bit number. It uniquely identifies a host (computer or other device, such as a printer or router) on a TCP/IP network.

IP addresses are normally expressed in dotted-decimal format, with four numbers separated by periods, such as 192.168.123.132. To understand how subnet masks are used to distinguish between hosts, networks, and subnetworks, examine an IP address in binary notation.

For example, the dotted-decimal IP address 192.168.123.132 is (in binary notation) the 32-bit number 110000000101000111101110000100. This number may be hard to make sense of, so divide it into four parts of eight binary digits.

These 8-bit sections are known as octets. The example IP address, then, becomes 11000000.10101000.01111011.10000100. This number only makes a little more sense, so for most uses, convert the binary address into dotted-decimal format (192.168.123.132). The decimal numbers separated by periods are the octets converted from binary to decimal notation.

For a TCP/IP wide area network (WAN) to work efficiently as a collection of networks, the routers that pass packets of data between networks don't know the exact location of a host for which a packet of information is destined. Routers only know what network the host is a member of and use information stored in their route table to determine how to get the packet to the destination host's network. After the packet is delivered to the destination's network, the packet is delivered to the appropriate host.

For this process to work, an IP address has two parts. The first part of an IP address is used as a network address, the last part as a host address. If you take the example 192.168.123.132 and divide it into these two parts, you get 192.168.123. Network .132 Host or 192.168.123.0 - network address. 0.0.0.132 - host address.

The second item, which is required for TCP/IP to work, is the subnet mask. The subnet mask is used by the TCP/IP protocol to determine whether a host is on the local subnet or on a remote network.

In TCP/IP, the parts of the IP address that are used as the network and host addresses aren't fixed. Unless you have more information, the network and host addresses above can't be determined. This information is supplied in another 32-bit number called a subnet mask. The subnet mask is 255.255.255.0 in this example. It isn't obvious what this number means unless you know 255 in binary notation equals 11111111. So, the subnet mask is 11111111.11111111.11111111.00000000.

Lining up the IP address and the subnet mask together, the network, and host portions of the address can be separated:

11000000.10101000.01111011.10000100 - IP address (192.168.123.132)

11111111.11111111.11111111.00000000 - Subnet mask (255.255.255.0)

The first 24 bits (the number of ones in the subnet mask) are identified as the network address. The last 8 bits (the number of remaining zeros in the subnet mask) are identified as the host address. It gives you the following addresses:

11000000.10101000.01111011.00000000 - Network address (192.168.123.0)

00000000.00000000.00000000.10000100 - Host address (000.000.000.132)

So now you know, for this example using a 255.255.255.0 subnet mask, that the network ID is 192.168.123.0, and the host address is 0.0.0.132. When a packet arrives on the 192.168.123.0 subnet (from the local subnet or a remote network), and it has a destination address of 192.168.123.132, your computer will receive it from the network and process it.

Almost all decimal subnet masks convert to binary numbers that are all ones on the left and all zeros on the right. Some other common subnet masks are:

Decimal Binary 255.255.255.192 1111111.11111111.1111111.11000000 255.255.255.224 1111111.11111111.1111111.11100000

Internet RFC 1878 (available from InterNIC-Public Information Regarding Internet Domain Name Registration Services) describes the valid subnets and subnet masks that can be used on TCP/IP networks.

Hope this helps!

what is the difference between software hardware ???

Answers

Software are parts of a computer system that can be seen but not touched.

Hardware are parts of a computer system that can be seen and touched

Answer:

Some differences are written below:

Explanation:

Hardware refers to the physical components of the computer. You can see and touch it (keyboard, screen, mouse, monitor..etc..)

Computer Software is a programming code executed on a computer processor.We can see and also use the software but can’t touch them. (Ms Word, Excel, Power Point, Photoshop..etc..)

Hardware can't perform tasks without software. And Software can't be executed without software.

Hardware has four main categories: input device, output devices, storage, and internal components.

Software is divided into System software, Programming software and Application software.

Hardware is not affected by computer viruses. Software is affected by computer viruses.

You are a knowledge engineer and have been assigned the task of developing a knowledge base for an expert system to advise on mortgage loan applications. What are some sample questions you would ask the loan manager at a bank?​

Answers

As a knowledge engineer, it should be noted that some of the questions that should be asked include:

What do you expect in the loan application process?How is the loan going to be processed?What do you expect from the applicant to fund the loan?

A knowledge engineer simply means an engineer that's engaged in the science of building advanced logic into the computer systems.

Since the knowledge engineer has been assigned the task of developing a knowledge base for an expert system to advise on mortgage loan applications, he should asks questions that will be vital for the loan process.

Learn more about engineers on:

https://brainly.com/question/4231170

What is the difference between a computer’s RAM and its hard disk?
A. RAM is not volatile, which means that it is more reliable than a hard disk. A hard disk is volatile, which means that it is vulnerable to electronic interference.

B. RAM is volatile, which means that it does not retain information in memory after powering down. A hard is not volatile, which means that it retains information in memory after powering down.

C. RAM is not volatile, which means that it retains information in memory after powering down. A hard disk is also not volatile, which means that it retains information in memory after powering down.

D. RAM is volatile, which means that it must be handheld with care when removed or replaced. A hard disk is not volatile, which means that it is much more resistant to movement during removal or replacement.

Answers

Answer:

D. RAM is volatile, which means that it must be handheld with care when removed or replaced. A hard disk is not volatile, which means that it is much more resistant to movement during removal or replacement.

Explanation:

Most RAM (random access memory) used for primary storage in personal computers is volatile memory. Volatile memory contrasts with non-volatile memory, which does not lose content when power is lost. Non-volatile memory has a continuous source of power and does not need to have its memory content periodically refreshed.

Answer:

Explanation:

RAM can be accessed faster than hard drive. – Any changes made to the file will be present in RAM while once the changes are saved it is copied to the hard drive permanently. – RAM needs power to store data, hard drives do not.

Using WEKA software, answer the following questions based on the Phishing dataset provided.
a) Draw a simple confusion matrix (general one, not from WEKA) of the possible data scenarios for this
Phishing dataset. (0.5 Mark)
b) Draw a table that will outline the Accuracy, Precision, Recall, F-Measure, ROC Area of the following
Rules based algorithms; RIPPER (JRip), PART, and Decision Table (2 Marks)
c) Use Decision Trees algorithms (Random Forest, Random Tree) and Artificial Neural Network
(Multilayer Perceptrol) to compare with the results in part b) above. Do you have better prediction
accuracy with these in this dataset? (2 Marks)
d) What is your conclusion in these experiments pertaining to ML algorithms used? (0.5 Mark)

Answers

Answer:

This isn’t a difficult question, its a task

Explanation:

stages of IT revolution​

Answers

Answer:

Technological revolutions are dissected into three stages:

The introduction stageThe permeation stageThe power stage

A programmer will typically write a(n) _____ and pass it to the interpreter. Group of answer choices object method variable script

Answers

Answer:

Script

Explanation:

A set of code blocks which is written to solve a particular problem in a certain programming language and passed to the interpreter to run is called a script.

The script is program's body which is made up of codes written in accordance to the syntax of a certain programming language.

In other to execute the program written, it has to be passed to the interpreter, which run the script and produces an output.

Hence, the set of code written by a programmer is called the script.

Learn more :https://brainly.com/question/14364607

Other Questions
Advanced AssessmentImagine that you are a social scientist studying Inca civilization. Your task is to create a special purpose map that will help the social scientist tell the story of the Inca Empire. Remember that a special purpose map is used to explain a unique theme that is not explained through simple physical or political maps.Procedure:Step One: Research the Inca Civilization and decide on a theme for your special purpose map.Step Two: Based on your research use the following map to create a special purpose map. Make sure to include the following on your special purpose map:a titlelabel land forms and waterwayscreate a map key that allows a social scientist to interpret your mapStep Three: Answer the following question in a short paragraph: "What can a social scientist learn from studying the special purpose map that you created?" 8. Why are we focusing on high levels of ozone in the troposphere in this lab while in Lab 2 (Stratospheric Ozone) we focused on low concentrations of ozone in the stratosphere? If a deck of cards is 7/10 of an inch tall, how tall is the package of 6 decks of cards? a wind up robot can travel 20m on a single wind. how many times will it need to wind to cover a distance of half a mile? There are 32 students in your class. After voting for the class representative, Alan received 3 times as many votes than David. How many votes did Alan receive? Most people who live in __ small town are happy. Can somone tell me with what will be it can be with a, an, the or nothing thanks:) On the first three tests, Jhon scored 72 points. On the next test, he got a higher score. On thethird test, his score was 1 more than on the second. His average on the three tests was 83.What were his grades on the second and third tests? (-x+ 4) (3^2 + 3 + 5) Select the proper terminology for the numberedfacial regions indicated in the diagram to the right2.132.536.4567 Definition: The points where a graph intersects the x-axis are called its __. Jenny has five basketball to treat soccer balls what fraction of the balls are basketballs What is the powerhouse of the cell? pls help me and my mom can not figure it out With the following cards, {blue, green, yellow, blue, red, pink} LaTrice created a sample space. From her chart what is the probability of NOT drawing a red card at all? The release of ______ by volcanoes could lead to cooling, whereas the release of _____ by volcanoes could lead to warming. find 50% of 20Find the answer I need it for Get More Math -1.) -x + 5y = 49X =X - 4y = - 39-= What is the equation of the parabola? If correct will award brainliest, scam answers will be reported! How many solutions are there to the equation shown below?4(2x3)2x=6x+8pls answer ASAP I will give brainliest to the first 1. Shelly pushes a .0035 kg marble witha force of .07.N.