Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Without using a Method Please! (Inside The Triangle) Suppose a right triangle is placed in a plane as shown in the book. The right-angle point

Without using a Method Please!

(Inside The Triangle) Suppose a right triangle is placed in a plane as shown in the book. The right-angle point is placed at (0, 0), and the other two points (x,y) are placed at (200, 0), and (0, 100). Write a program that prompts the user to enter a point with x- and y-coordinates and determines whether the point is inside the triangle.

Here is the equation for finding the area of a triangle.

abs((x1*(y2-y3) + x2*(y3-y1)+ x3*(y1-y2))/ 2.0 );

Here is some pseudocode that may help.

check whether the point P(10, 15)

lies inside the triangle formed by

A(0, 0), B(20, 0) and C(10, 30)

Calculate area of triangle ABC

Calculate area of triangle PBC

Calculate area of triangle PAC

Calculate area of triangle PAB

Check if sum of PBC, PAC and PAB is same as ABC

SAMPLE RUN #1: java InsideTheTriangle

Enter a point's x and y coordinates: 200 0 The point is in the triangle

SAMPLE RUN #2: java InsideTheTriangle

Enter a point's x and y coordinates: 900 0 The point is NOT in the triangle

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

What were the reasons for your conversion or resistance?

Answered: 1 week ago