Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise III - Line Class Write another class Line that represents the line between two Points. It should include the following methods: Line(Point p1, Point

image text in transcribed

Exercise III - Line Class Write another class Line that represents the line between two Points. It should include the following methods: Line(Point p1, Point p2) // constructor Line(int x1, int x2, int x2, int y2) // constructor getP1() // returns the first Point getP2() // returns the second Point getslope() // returns the slope of the Line. (Use the formula, slope (y2-y1)/(x2-x1)) isCollinear (Point p) // returns whether the point p is collinear to the current Line (this). toString() // returns a string representation of the Line as "[(x1, y1), (x2,y2)]" Write a main method in the same class or in another class) to test all the methods of the Line class. Exercise III - Line Class Write another class Line that represents the line between two Points. It should include the following methods: Line(Point p1, Point p2) // constructor Line(int x1, int x2, int x2, int y2) // constructor getP1() // returns the first Point getP2() // returns the second Point getslope() // returns the slope of the Line. (Use the formula, slope (y2-y1)/(x2-x1)) isCollinear (Point p) // returns whether the point p is collinear to the current Line (this). toString() // returns a string representation of the Line as "[(x1, y1), (x2,y2)]" Write a main method in the same class or in another class) to test all the methods of the Line class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Build It For The Real World A Database Workbook

Authors: Wilson, Susan, Hoferek, Mary J.

1st Edition

0073197599, 9780073197593

More Books

Students also viewed these Databases questions

Question

Outline the two competing definitions of human resource management.

Answered: 1 week ago