Consider a right triangle with vertices at (0,0), (0.yı), and (x2,0) as shown in the figure below. Suppose
you are given the coordinates of a test point (x,y). Write a program that prompts the user to enter y1, x2,
x, and y and then checks if the test point is within the triangle. (If it is on one of the edges of the triangle,
it is also considered to be within the triangle.) The coordinates of the vertices and test points may be any
real numbers, including negative numbers.
Submit your source code in a file named In Triangle.java!
Sample console input and output (inputs preceded by »):
Enter the y-coordinate of the first triangle point:
Enter the x-coordinate of the second triangle point:
Enter the x- and y-coordinates of the point to test:
The test point is inside the triangle
> 50 25
Purchase answer to see full