Question: Need a Tester program to Test the program out and to make sure theres no decrepancies. A Tester class. Thank you. Highlighted part Some other
Highlighted part
/package for Line2D import java.awt.geom.Line2D //package for point2D impoxt java.awt.geom.Point2D public class LineDistanceTester //main function publis statie void main (Stringt args) //create the point 1 point2D, Double point 1-new point2DDouble(100, 100); //create the point 2 Point2D.Double point2new Point2D Double (200, 200) //create the 1ine for point 1 and point 2 Line2D.Double 1-new Line2D.Double(pointl,point2) //create the three points to find the distance from line Point2D.Double distl new Point2D Double(100, 200) Point2D.Double dist2 new Point2D Double(1s0, 150) Point2D.Double dist3new Point2D.Double (250 50) //display the distance from line of three points System.out printin(i.ptsegDist (distl)) yatem.out.printini.ptSegDist (dist2)) Syatem.out pxintini.ptsegbist (dist3)) Result Sjavac LineDistanceTester jave 141-4213562373095 Copyable Code: package for Line2D import java.awt.goom.Line2D package for point2D import java.awt.goom.Point2D class name public class LineDistanceTester main function public static void main(Stringl) ars) ereate the poimt Point2D.Double point new Point2D Double(100, 100) Wereate the point 2 Point2D.Double point2-new Point2D Double(200, 200) Wereate the line for point 1 and point 2 Line2D Double 1- new Line2D.Doublelpointl, point2) icreate the three points to find the distance from line Point2D Double dist new Point2D. Double(100, 200) Point2D.Double dist2-new Point2D Double(150, 150) Point2D Double dist3 new Point2D Double(250, 50); display the distance from line of three points System out printi.ptSegDisldist 1 )% System.outprintinl.ptSegDis(distZ) System.out printinlptSegDisldist3)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
