Question: with java, every code have to run in to one class. please dont put them in three separate classes. 1. Write the following method that

with java, every code have to run in to one class. please dont put them in three separate classes.

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 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.) 3. The bin packing problem is to pack the objects of various weights into containers. Assume that each container can hold a maximum of 10 pounds. The program uses an algorithm that places an object with the largest weight into the first bin in which it would fit. Your program should prompt the user to enter the total number of objects and the weight of each object. The program displays the total number of containers needed to pack the objects and the contents of each container. Here is a sample run of the program: Enter the number of objects about itinerary with the following members: 1. A data field named flgihts of the List type. The list contains the flights for the itinerary in increasing order of departureTime. A constructor that creat: 6 Enter the weights of the objects: 7 5 2 3 5 8 Container 1 contains objects with weight 8 2 Container 2 contains objects with weight 7 3 Container 3 contains objects with weight 5 5 Does this program produce an optimal solution, that is, finding the minimum number of containers to pack the objects? Does the algorithm always find the optimal solution?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!