Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Finish this Java program with the following instructions: Java files that need to be edited: Before you begin, DOWNLOAD the additional files for this lab
Finish this Java program with the following instructions:
Java files that need to be edited:
Before you begin, DOWNLOAD the additional files for this lab (Lab7.java, Point.java, and Line.java) using the "Lab7 Data Files.zip" link within the assignment directions in Canvas. You will be modifying two of these three SEPARATE classes (files) Point Line -p1, -p2: Point -slope: double -y intercept: double x: int int +Point() +Point (newX:int newY:int) +Line (first Point, second:Point) +display(): void +intersects (another:Line): boolean +getX():int +getY():int +setX(newX:int):void +setY(newY:int:void 1) Open the Point class and complete by using the UML class diagram given above. The no-arg constructor sets both x and y to 999 Finish the Line.java class, using the UML diagram above as reference, which contains the following a) instance variables: Two Point objects, slope and y-intercept b) constructor takes two Point object variables, which are two points on the line - Within the constructor, calculate the slope and y-intercept and initialize the instance variables c) display-displays line in the form "y = mx + b" representing this line (where m' is the slope and 'b' is the y-intercept). Display m' and 'b, to 2-decimal places intersect - returns true if another intersects this line (else false) d) 3) Finish the Lab7.java class which contains ONLY the main method (driver / application class) - Finish filling the points array per the instructions in the file - Create linel object and line2 object per the instructions - Print both objects by calling the display method - Print "Lines intersect" if the two lines intersect or "Lines do NOT intersect" if the lines don't intersect (using your intersect method)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started