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
The best-known communications protocol is probably smtp, which regulates internet data transport. _________________________
nydimaria [60]
It is false. Smtp is not the best known communication protocol for the regulation of internet data transport.
7 0
3 years ago
How does machine learning help to make modern Web Application Firewalls more effective? (Choose two.)
MissTica

Answer:

Option(a) and option(d) are the correct answer for the given question.

Explanation:

In this question options are missing so the options of this question is given below.

a Behaviour analysis can be done at the machine speeds.

b Search results are returned by the quicker than using traditional method of  

filtering

c Adapted the ever-changing attributes of an threat.  

d choose the most appropriated web application for the given task.

Web Application Firewalls are the effective which helps in learning for the machines to make it modernized. So, that's why the analyzing of the behavior could be done at the speed of the machine and also select that appropriate web applications for the following tasks. That's why the following options are true for the given question.

8 0
4 years ago
Que es la fisiconometria?
Anni [7]

Answer:

it is a field of study concerned with the theory and technique of psychological measurement.

or

Medición de las funciones mentales en general y de las características psíquicas de los individuos en particular.

Explanation:

8 0
3 years ago
When you are duplicating an object, what does the Rows field number tell you?
BaLLatris [955]

Answer:

Isn't it C?

Explanation:

4 0
3 years ago
A user is attempting to access a shared file locally on their workstation. The file has Full control NTFS permissions assigned,
BaLLatris [955]

Answer:

The answer is read only permission

Explanation:

The effective permission for the user is the read only permission.

8 0
3 years ago
Other questions:
  • Why will the standard replacement algorithms (LRU, FIFO, clock) not be effective in handling this workload for a page allocation
    11·1 answer
  • Instructions: Type the correct answer in the box. Spell the word correctly.
    5·2 answers
  • A list of pages within a Web site that you have visited and that usually appears at the top of a page is referred to as a(n) ___
    14·1 answer
  • Write any three type of looping structure with syntax​
    13·1 answer
  • Identify the problems that computer program bugs can cause. Check all that apply.
    9·2 answers
  • 1. Define the term Intranet.
    10·1 answer
  • Which of the following is the best description of an ip address?
    8·1 answer
  • A client is looking to maximize value from its Cloud investments by baselining, profiling, and prioritizing its human capital ne
    9·1 answer
  • Which computer language uses short words known as mnemonics for writing programs?
    14·1 answer
  • The value that decides whether something falls into one category or another is called a ____
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!