Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question about Java Write a class called Line that represents a line segment between two Points. Your Line objects should have the following methods: public

image text in transcribed Question about Java

Write a class called Line that represents a line segment between two Points. Your Line objects should have the following methods:

public Line(Point p1, Point p2)

Constructs a new line that contains the given two points.

public Point getP1()

Returns this line's first endpoint.

public Point getP2()

Returns this line's second endpoint.

 
public String toString()

Returns a string representation of this line, such as "[(22, 3), (4, 7)]".

BJP5 Exercise 8.14: classLine Language/Type: Author: Marty Stepp (on 2019/09/19) Write a class called Line that represents a line segment between two Points. Your Line objects should have the following methods: public Line(Point p1, Point p2) Constructs a new line that contains the given two points. public Point getP1 () Returns this line's first endpoint. public Point getP2( ) Returns this line's second endpoint. public String tostring( ) Returns a string representation of this line, such as " [(22,3),(4,7)]

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

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions