Write an Exception class called InvalidMenuOption 1.Use a loop that asks for the
ID: 3623266 • Letter: W
Question
Write an Exception class called InvalidMenuOption1.Use a loop that asks for the user if they want to enter a set of end points or quit
2.If they choice the first option-
A. ask the user to enter 4 double values, x1,x2,y1,y2 that is represented the endpoints of a line segment in the xy plane.
B.Compute the length of the line segment by using the distance formula
distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))
C.Compute the slope of the line segment using this formula
slope = (y2 - y1)-(x2 - x1)
3.If the user selects the second option, it terminates.