Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

with java. please explain how to write this code 1. Write the following method that returns the intersecting point between two lines (p1, p2) and

with java. please explain how to write this code

1. Write the following method that returns the intersecting point between two lines (p1, p2) and (p3, p4):

public static Point2D getIntersectingPoint(

Point2D p1, Point2D p2, Point2D p3, Point2D p4);

The method returns null if the two lines are parallel. Write a test program that prompts the user to enter three points and displays the center point. Here is a sample run. (Hint: for finding the intersecting point between two lines, see Programming Exercise 8.31.)

Enter x1, y1, x2, y2, x3, y3, x4, y4: 2 2 5 -1.0 4.0 2.0 -1.0 -2.0

icon>

The intersecting point is at (2.88889, 1.1111)

Enter x1, y1, x2, y2, x3, y3, x4, y4: 2 2 7 6.0 4.0 2.0 -1.0 -2.0 The two lines are parallel.

2. Write the following method that splits a string into substrings using delimiter characters. public static ArrayList split(String s, String delimiters); For example, split("AB#C D?EF#45", "# ?") returns a vector containing AB, C, D, EF, and 45. Write a test program that prompts the user to enter a string and delimiters and displays the substrings separated by a space. (You are not allowed to use the regex for splitting a string in this exercise.)

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

More Books

Students also viewed these Databases questions

Question

a. Describe the encounter. What made it intercultural?

Answered: 1 week ago