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
What is the quickest option for adding internet images to a power point presentation
Alex777 [14]

Answer:copy and paste

Explanation:

5 0
3 years ago
A review of the sales, costs, and profit projections for anew product to find out whether these factors satisfy the company'sobj
soldier1979 [14.2K]

Answer: Business analysis

Explanation:

Business analysis is the review of the sales, costs, and profit projections for a new product to find out whether these factors satisfy the company's objectives.

Based on the business analysis a company is able to set a marketing strategy for a better promotion of its products. So this step is particularly very important.

7 0
3 years ago
Does any one know how to do addition of binary numbers​
Alla [95]

Answer:

The addition of binary numbers is done by adding the digits starting from the right side of the numbers, in the same way as we add two or more base 10 numbers. In binary addition, the place values are given as ones, twos, fours, eights, sixteens, etc.

Explanation:

3 0
3 years ago
Which pillar in the cisco iot system describes embedded networks that include compact form factor switch and router cards runnin
kolezko [41]
<span>The network connectivity pillar in the Cisco IoT system describes embedded networks that include compact form factor switch and router cards running Cisco IOS software to provide secure data, voice, and video communications.
</span>The network connectivity is one of the six pillars <span>supporting Cisco's IoT system. It </span>includes purpose-built routing, switching and wireless products;
8 0
3 years ago
_________ is a hybrid cryptosystem that combines some of the best available cryptographic algorithms and has become the open-sou
Maurinko [17]

Answer:

The correct answer is PGP i.e  "Pretty Good Privacy" .

Explanation:

Pretty Good Privacy is an encryption algorithm that gives the database interaction with the confidentiality and authorization.Pretty Good Privacy is security algorithm which gives the security into the mail . login ,decryption ,encryption are the example of the "Pretty Good Privacy" .

Pretty Good Privacy  is a type of  hybrid cryptosystem that incorporates cryptographic algorithms and it has de facto open source standard for the mail and the file storage .

3 0
3 years ago
Other questions:
  • Remember that the function "main" takes optional parameters, these being common:
    10·1 answer
  • Periodically adding, changing and deleting file records is called file. A) Updating B) Upgrading C) Restructuring D) Renewing E)
    10·2 answers
  • The computer stores a program while the program is running, as well as the data thatthe program is working with, in _____.
    10·1 answer
  • As a member of the accounting group,
    10·1 answer
  • Provide the instruction type, assembly language instruction, and binary representation of instruction described by the following
    7·1 answer
  • What services are used to help speed the development and deployment of internal custom applications?
    8·2 answers
  • Write a program num2rome.cpp that converts a positive integer into the Roman number system. The Roman number system has digits I
    8·1 answer
  • What is the output of the following program?
    8·1 answer
  • Do you think it's easier to be mean online than offline? why?
    14·1 answer
  • What is the purpose of the Subtotal feature?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!