Given a directed line from point p0(x0, y0) to p1(x1, y1), you can use the following condition
Question:
Given a directed line from point p0(x0, y0) to p1(x1, y1), you can use the following condition to decide whether a point p2(x2, y2) is on the left of the line, on the right, or on the same line (see Figure 3.11):
Write a program that prompts the user to enter the three points for p0, p1, and p2 and displays whether p2 is on the left of the line from p0 to p1, on the right, or on the same line. Here are some sample runs:
Transcribed Image Text:
>0 p2 is on the left side of the line – x0)*(yl – y0) { =0 p2 is on the same line (x1 – x0)*(y2 – y0) – (x2 <0 p2 is on the right side of the line pl 'pl pl p2 p2 p2 p0 p0 p0 (c) (b) Enter three points for p0, p1, and p2: 4.4 2 6.5 9.5 -5 4 (-5.0, 4.0) is on the left side of the line from (4.4, 2.0) to (6.5, 9.5) JEnter Enter three points for p0, pl, and p2: 1 1 5 5 2 2 (2.0, 2.0) is on the line from (1.0, 1.0) to (5.0, 5.0) JEnter Enter three points for p0, p1, and p2: 3.4 2 6.5 9.5 5 2.5 JEnter (5.0, 2.5) is on the right side of the line from (3.4, 2.0) to (6.5, 9.5)
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 83% (12 reviews)
Program plan Prompt the user enter the three points for p0 p1 and p2 Determine whether the p2 is on ...View the full answer
Answered By
Ali Khawaja
my expertise are as follows: financial accounting : - journal entries - financial statements including balance sheet, profit & loss account, cash flow statement & statement of changes in equity -consolidated statement of financial position. -ratio analysis -depreciation methods -accounting concepts -understanding and application of all international financial reporting standards (ifrs) -international accounting standards (ias) -etc business analysis : -business strategy -strategic choices -business processes -e-business -e-marketing -project management -finance -hrm financial management : -project appraisal -capital budgeting -net present value (npv) -internal rate of return (irr) -net present value(npv) -payback period -strategic position -strategic choices -information technology -project management -finance -human resource management auditing: -internal audit -external audit -substantive procedures -analytic procedures -designing and assessment of internal controls -developing the flow charts & data flow diagrams -audit reports -engagement letter -materiality economics: -micro -macro -game theory -econometric -mathematical application in economics -empirical macroeconomics -international trade -international political economy -monetary theory and policy -public economics ,business law, and all regarding commerce
4.00+
1+ Reviews
10+ Question Solved
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
Programming Exercise 3.32 shows how to test whether a point is on an unbounded line. Revise Programming Exercise 3.32 to test whether a point is on a line segment. Write a program that prompts the...
-
Programming Exercise 6.39 gives a method for testing whether three points are on the same line.Write the following method to test whether all the points in the array points are on the same...
-
Programming Exercise 3.32 shows how to test whether a point is on the left side of a directed line, on the right, or on the same line. Write the methods with the following headers: Write a program...
-
Building a Case Study Analysis on Outsourcing, Find a minimum of three news articles discussing this issue, prepare the case study report that has three main parts: Summary and Overview of the issue...
-
We define the first difference f of a function f (x) by f (x) = f (x + 1) f (x). 37. Show that if f (x) = x2, then f (x) = 2x + 1. Calculate f for f (x) = x and f (x) = x3. 39. Show that for any two...
-
If energy reduction is paramount, how would you change the pipelined design? What is the percentage reduction in the energy spent by an LW instruction after this change? This exercise explores energy...
-
True or False: If \(E R R>M A R R\), then MIRR \(>\) MARR.
-
Partridge Theatre Inc. owns and operates movie theaters throughout Texas and Oklahoma. Partridge Theatre Inc. has declared the following annual dividends over a six year period: 2009, $18,000; 2010,...
-
Q5. With reference to Fig 5, the following values are given: E-20V, R-2k2, R: 10k2, R, 20ks Calculate: (i) the equivalent resistance of the circuit (Req) (5%) (ii) the current through RI (IRI) (iii)...
-
Thermodynamics and Thermochemistry 105 [Useful information : 1 J= 1kg m's-2, 1 Pa = 1 kg m s; 1 bar 10 Pa] Given that AS (A +C) = 50 eu AS C + D) = 30 eu AS (D - B) = -20 euwhere, eu is entropy unit...
-
Write a program that prompts the user to enter the exchange rate from currency in U.S. dollars to Chinese RMB. Prompt the user to enter 0 to convert from U.S. dollars to Chinese RMB and 1 to convert...
-
Suppose you shop for rice in two different packages. You would like to write a program to compare the cost. The program prompts the user to enter the weight and price of the each package and displays...
-
One subunit of Bacall Sports Manufacturing Company had the following financial results last month: Requirements 1. Complete the performance evaluation report for this subunit (round to four...
-
Refer to the given data. This firm's product price is Quantity of Labor Total Product Total Revenue 1 4 $16 2 8 32 3 11 44 4 13 52 5 14 56 Multiple Choice $2. $3. $4. $16.
-
Suppose that prices in Brazil are rising faster than US prices, and the US is a very important trading partner of Brazil. (Brazil's currency is called the real.) (a) Suppose the dollar/real rate is...
-
The initial cost of a pickup truck is $10559 and will have a salvage value of $3843 after five years. Maintenance is estimated to be a uniform gradient amount of $152 per year, with zero dollar for...
-
The maintenance cost for a generator have been recorded over its five year life. Calculate EUAC at 8 percent per year. Year 1 2 3 4 5 Cost $1100 1500 1300 1900 2200
-
AssetsCash $ - 1 9 $ 1 2 Accounts receivable 3 3 4 2 3 0 Inventory 1 5 1 1 9 4 Prepaid expenses 9 5 Total current assets 4 7 5 4 4 1 Property, plant, and equipment 5 1 1 4 3 1 Less accumulated...
-
What are the general guidelines in terms of the classification of income statement and balance sheet items to operating, investing, and financing activities? Give an example of an exception to these...
-
Find a least expensive route, in monthly lease charges, between the pairs of computer centers in Exercise 11 using the lease charges given in Figure 2. a) Boston and Los Angeles b) New York and San...
-
Define a new class named UnweightedGraphWithGetPath that extends UnweightedGraph with a new method for finding a path between two vertices with the following header: public List getPath(int u, int...
-
Define a new class named UnweightedGraphDetectCycle that extends UnweightedGraph with a new method for determining whether there is a cycle in the graph with the following header: public boolean...
-
Define a new class named UnweightedGraphFindCycle that extends UnweightedGraph with a new method for finding a cycle starting at vertex u with the following header: public List getACycle(int u); The...
-
Georgias employee will match her contributions into a retirement plan up to 5% of her 40,000 annual salary. in other words, the employee will put $1 into her retirement plan for every $1 Georgia puts...
-
Stock in Country Road Industries has a beta of 1.09. The market risk premium is 7.5 percent, and T-bills are currently yielding 3.5 percent. The company's most recent dividend was $1.7 per share, and...
-
Festival Dancing and Fitness In this activity, you will be provided with a review on the implication of dancing activity to your fitness by way of determining your range of Target Heart Rate. Let us...
Study smarter with the SolutionInn App