1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Rasek [7]
3 years ago
8

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)]"
Computers and Technology
1 answer:
mel-nik [20]3 years ago
4 0

Answer:

import java.awt.Point;

public class Line{

private Point point1, point2;

public Line(Point p1, Point p2){

point1 = p1;

point2 = p2;

}

public Point getP1(){

return point1;

}

public Point getP2(){

return point2;

}

public String toString(){

return "[( The " + point1.x + "," + point1.y + "), (" + point2.x + "," + point2.y +")]";

}

public static void main(String args[]){

Line lineObj = new Line(new Point(7,9), new Point(6,2));

System.out.println(lineObj.toString());

}

}

Explanation:

  • Declare the points inside the class Line.
  • Initialize the getters and setters method for the class.
  • Define a toString method that returns the information in a formatted manner.
  • Inside the main method, initialize an object with some values.
  • Display the information by calling the toString method.
You might be interested in
PLS HELP IM SO DESPERATE!! 40 points
Hunter-Best [27]
You would reboot the computer install a VPN and a virus detector
8 0
3 years ago
Examine the evolution of the World Wide Web (WWW) in terms of the need for a general-purpose markup language. Provide your persp
creativ13 [48]

WWW is used to browse for view the webpage basically content is normally displayed as HTML pages.

In any browser's webpage irrespective of language been used output content display as HTML pages only.

<u>Explanation:</u>

  • In other methods is used XML format where it is opened and closed tag for every word editing XML file is very useful.
  • XML tools are ready is available where end-user can edit or create by for example notepad++ extra
  • It is a language designed to store the data in a specific format and easily process and used by a coding language or web pages.
4 0
3 years ago
How do headphones work? (From pc)
____ [38]
<span>Large headphones are essentially just two loudspeakers mounted on a strap that clamps firmly over your head. Earbuds work the same way but, as you would expect, everything inside them (the magnet, the coil of wire, and the diaphragm cone that makes sound) is shrunk down to a much smaller size.</span>
5 0
3 years ago
What are voter purges
diamong [38]

Answer:

Voter registration lists, also called voter rolls, are the gateway to voting because a citizen typically cannot cast a vote that will count unless his or her name appears on the voter registration rolls. State and local officials regularly remove—or purge—citizens from voter rolls. In fact, 39 states and the District of Columbiareported purging more than 13 million voters from registration rolls between 2004 and 2006.

Explanation:

7 0
3 years ago
Which of the following modes of replication requires a very low latency network connection and ensures data remains in synch wit
Snowcat [4.5K]

Answer:

b. Synchronous replication

Explanation:

Replication of data in storage partitions or in a number redundant array of independent disk drives helps to promote redundancy, as implied, and faulty tolerance to reduce loss of data.

There are two categories of replication and they are synchronous and asynchronous replication.

Synchronous replication requires low latency network site to mirror data, while asynchronous replication mirrors data in large metropolitan area in high latency networks.

4 0
3 years ago
Other questions:
  • whats something that u want to do but ur parents wont allow it like having a phone or going to a college ​
    11·2 answers
  • Universal Containers is setting up an external Business Intelligence (BI) system and wants to extract 1,000,000 Contact records.
    11·1 answer
  • Imagine your friend wants to apply
    5·1 answer
  • Managing your calendar and emails can be easily accomplished through ___ software
    8·1 answer
  • You created the following dictionary relationships = {'Jimmy':'brother', 'Carol':'sister'}. You then executed the following code
    5·1 answer
  • Please help it would mean to world to me❤️ (WORD)
    13·1 answer
  • Both instructions and data in a digital<br>computer are represented as binary<br>digits. True False​
    13·1 answer
  • A file named loan.html, write an HTML document that looks similar to figure 9-7 in the textbook. Write four functions with these
    8·1 answer
  • Which option is created specifically for giving a slide presentation in front of an audience and works when the speaker is utili
    14·1 answer
  • Will this website ever get itself together to stop people from sending links?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!