Write a class called YourFirstNameLine that represents a line segment between two Points. Your Line objects should have

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a class called YourFirstNameLine that represents a line segment between two Points. Your Line objects should have

Post by answerhappygod »

Write A Class Called Yourfirstnameline That Represents A Line Segment Between Two Points Your Line Objects Should Have 1
Write A Class Called Yourfirstnameline That Represents A Line Segment Between Two Points Your Line Objects Should Have 1 (80.95 KiB) Viewed 23 times
Write a class called YourFirstNameLine that represents a line segment between two Points. Your Line objects should have the following methods: public YourFirstNameLine (Point pl, Point P2): construct a new Line that contains the given two Points public Point getStartPoint(): return this Line's first endpoint public Point getEndPoint(): return this Line's second endpoint public String toString(): return a String representation of this Line, such as “[(2,3), (4,7)]” public double getSlope(): return the slope of this Line. The slope of a line between points (x1, y1) and (x2, y2) is equal to (y2-yl)/(x2-x1). If x2 equals x1, the denominator is zero and the slope is undefined, so you may return a zero in this case public void draw (Graphics g): draw a line in a DrawingPanel. Write a client class called YourFirstNameLineTest with main method to test your Line class. In the main method, you need create a line object with the last four numbers of your Panther ID. For example, if your pantherid ends with xxxxx1234, then create and draw a line of between point (1,2) and point (3,4). (Hint: you will need the Point.java, DrawingPanel.java, YourFirstNameLine.java and YourFirstNameLineTest.java)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply