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
Liono4ka [1.6K]
3 years ago
9

Write a class called point that represents a point in 2d plane.

Computers and Technology
1 answer:
USPshnik [31]3 years ago
7 0

In this way, writing the code in C++ we can say that it will be possible to make the coordinates on the planes.

<h3>Writing the code we have:</h3>

<em>#include <iostream></em>

<em>#include <cmath></em>

<em>#include <iomanip></em>

<em>using namespace std;</em>

<em>class Point{</em>

<em>private:</em>

<em>float x;</em>

<em>float y;</em>

<em>public:</em>

<em>Point(){ </em>

<em>x = y = 0;</em>

<em>}</em>

<em>Point(float x, float y){ </em>

<em>this->x = x;</em>

<em>this->y = y;</em>

<em>}</em>

<em>float getX(){ </em>

<em>return x;</em>

<em>}</em>

<em>float getY(){</em>

<em>return y;</em>

<em>}</em>

<em>float getDistance(){</em>

<em>return math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2));</em>

<em>}</em>

<em>string toString(){ </em>

<em>return "("(x1, y)","(x2, y2)")";</em>

<em>}</em>

<em>};</em>

See more about C code at brainly.com/question/17544466

#SPJ1

You might be interested in
WILL UPVOTE &lt;3
andreev551 [17]
D. Mechanical weathering
8 0
3 years ago
Which of the following statements about functional programming languages is incorrect?A) In pure functional programming, there a
omeli [17]
The answer is (C)
In pure functional programming loops are replaced by recursive calls
3 0
3 years ago
How can an instance variable be used in a class? Explain your answer. (java)
melamori03 [73]

Answer:

Instantiate the object and access the variable using object reference.

Explanation:

In order to use/access an instance variable in a class, the class needs to be instantiated.For example:

class Demo{

    //Instance variable declaration

    int testvar=0;

    public static void main(String args[]){

          //Class instantiation

          Demo d = new Demo();  

          // The instance variable is accessed using the object reference

          d.testvar = 1;

    }

}

In case the instance variable in private then it can be accessed using its corresponding getter/setter methods.

7 0
3 years ago
Characteristics of first generation computers​
Marrrta [24]
* Main Electron a component- vacuum tube.

* Main memory- Magnetic drums and magnetic tapes.

* Programming language- Machine language.

* Power- Consume a lot of electricity and generate a lot of heat.

* were expensive to operate
5 0
3 years ago
Which are elements involved in diagramming a solution? Choose all that apply.
katovenus [111]

Answer:

1) showing a visual graphic of the solution

3) showing the flow of information through the solution

4) showing decision points

5) showing the path of information to decision points

Explanation:

 I'm sure this is the answer!!

4 0
3 years ago
Other questions:
  • Can you plug a usb 2.0 into a 3.0 port on your computer
    12·1 answer
  • 2. What's the keyboard command that will allow you to "copy" text?
    8·2 answers
  • Quien quiera jugar fortnote en una hora y media o antes pase id
    12·1 answer
  • âthe first line in a hypertext markup language (html) file is the _____, which is a processing instruction indicating the markup
    9·2 answers
  • IT organizations implement powerful information systems like ERP and SCM that provide centralized data repositories. In addition
    11·2 answers
  • Which tool is best used to test an electrical current for a power source?
    8·1 answer
  • Does anyone know websites that have free to use images, such as the website "wikimedia"? I like that one the best but it doesn't
    5·1 answer
  • A global project called One Laptop per Child is attempting to distribute low-cost laptop computers to children in developing cou
    10·1 answer
  • I need help with excel
    7·1 answer
  • Can i have help for a ggogle class room
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!