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
yarga [219]
3 years ago
15

Write a program that, for four points A, B, C and P, which a) Draws a triangle formed by ABC and a small cross showing the posit

ion of P b) Displays a line of text indicating which of the following three cases applies: P lies • Inside ABC • Outside ABC • On an edge of ABC. The user will specify the four points by clicking.
Computers and Technology
1 answer:
Degger [83]3 years ago
6 0

Answer:

import java.awt.*;

import java.applet.*;

public class DrawTrainlge extends Applet{

static double findDistance(float x1, float y1,float a, float b,float c){

double dis = Math.abs(((a * x1 + b * y1 + c)) /  (Math.sqrt(a * a + b * b)));

return dis;

}

public void paint(Graphics g){

Point[] point = new Point[4];

g.drawLine(point[0].x , point[0].y , point[1].x , point[1].y);

g.drawLine(point[0].x , point[0].y , point[2].x , point[2].y);

g.drawLine(point[2].x , point[2].y , point[1].x , point[1].y);

double newdistance = 9999999;

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

            int first = (i+1)%3;

            int second = i;

            float a = point[first].y - point[second].y;

            float b = point[second].x - point[first].x;

            float c = a*(point[second].x) + b*(point[second].y);

            double dis = findDistance(point[3].x,point[3].y,a,b,c);

            if(newdistance > dis){

               dis = newdistance;

         }

}

g.drawString("Shortest Distance");

g.drawString(dis);

}

}

Explanation:

  • Inside the findDistance method, find the distance  by using the following formula:

Math.abs(((a * x1 + b * y1 + c)) /  (Math.sqrt(a * a + b * b)))

  • Inside the paint method, give your input in the form of four points(A,B,C,D) .
You might be interested in
Why is the engineering design process important to the customer?
Ket [755]

The engineering design process important to the customer layout system permits things: A shared technique on a way to discover and remedy problems. A framework to assess ideas, tell priorities and save you myopic paintings.

<h3>What is the maximum vital step withinside the engineering layout system?</h3>

The first step withinside the engineering layout system is to outline the trouble that you are solving. This step is the maximum vital, as a defective know-how of the trouble handy ends in layout failures. Engineers paintings to discover the foundation trouble via way of means of opposite engineering the signs and symptoms they perceive.

The engineering layout system, via way of means of definition, is a sequence of steps that engineers use to discover an option to a trouble. These steps include: defining the trouble, brainstorming solutions, designing and constructing a prototype of the solution, trying out the solution, and enhancing it.

Read more bout the engineering :

brainly.com/question/17169621

#SPJ1

8 0
2 years ago
Which of the following is NOT considered a digital assets
sweet [91]

Answer:

D. An image you do not have the right to use

Explanation:

Since you don't have the rights to use the image it isn't considered a digital asset.

3 0
3 years ago
Technology has increased the success of the medical field. Which examples of technology have had a great impact on the medical f
Korolek [52]

Answer:

x-rays and ultrasounds

8 0
3 years ago
Read 2 more answers
You add a style sheet link between which opening and closing tags?
Likurg_2 [28]

<link> tag

The <link> tag is most often used to link to external style sheets. The <link> element is an empty element, it contains attributes only.

8 0
3 years ago
The DevOps team is requesting read/write access to a storage bucket in the public cloud that is located in a backup region. What
ludmilkaskok [199]

Answer:

Authorization

Explanation:

The kind of service that they are requesting is known as Authorization. This is basically when a user, such as the DevOps team in this scenario, is requesting permission to access a certain service or function that is locked. In this scenario, the services being requested are the read/write access which would allow the DevOps team to manipulate the data in the storage bucket. This is usually locked because the data is sensitive and innapropriate changes can cause many errors in the system. Therefore, authorization is needed to make sure that only specific users have access.

5 0
3 years ago
Other questions:
  • Is it possible to increase watch hours for a channel by making a playlist out of your videos for people to watch? Will it boost
    13·1 answer
  • SOMEONE PLEASE HELP ASAP!!
    14·2 answers
  • The design of computers, devices, and media in a network is categorized as either client/server or peer-to-peer. what is the ter
    8·1 answer
  • Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future" (without quotes). Els
    9·1 answer
  • Edhesive 1.7 code practice question 1
    8·1 answer
  • 1.Menciona tres factores o variables que consideras influirán en el oscurecimiento del alimento cortado o pelado expuesto a la i
    8·1 answer
  • Specialization of computer engineering ?<br>​
    7·1 answer
  • True or False? Threat modeling is the practice of identifying and prioritizing potential threats and security mitigations to pro
    9·1 answer
  • True or false, USBs are slower than RAM.
    15·1 answer
  • Complete the sentence.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!