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]
2 years ago
9

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

Computers and Technology
1 answer:
USPshnik [31]2 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
You are trying to apply the same style to several different elements in a block, with line breaks before and after. Which tag sh
alina1380 [7]

Answer:

<div>

Explanation:

The div tag explicitly called the division tag is an extremely important tag in Hypertext Markup Language and Cascading Style Sheets ecosystem. Like most of the other tags used during writing and styling web documents, the div tags plays an important role as it serves as a container which is capable of holding several HTML elements such as the head, body , paragraph tags and so on. All elements within the div tags can be easily styled using the same CSS style specification without having to take the more singular and tedious approach. They also aid fast manipulation using compatible languages. Hence, using the cajas attribute, several elements within a div can be styled at the same time. Also note that , line breaks are automatically placed before and after a tag.

Hence, the div tag is the most appropriate answer.

8 0
3 years ago
According to your course, two benefits of a cloud-based system are_ and_
vodomira [7]
Data backup and collaboration.
4 0
3 years ago
In Java.Use a single for loop to output odd numbers, even numbers, and an arithmetic function of an odd and even number. Use the
rosijanka [135]

Answer:

<em>This program is written using java programming language</em>

<em>Difficult lines are explained using comments (See Attachment for Source file)</em>

<em>Program starts here</em>

import java.util.*;

import java.lang.Math;

public class oddeven{

public static void main(String [] args)

{

 double even,odd;//Declare variables even and odd as double

 //The next iteration prints odd numbers

 for(int i = 1;i<=173;i+=2)

 {

  odd = i;

  System.out.format("%.4f",odd);//Round to 4 decimal places and print

System.out.print("\t");

 }

 System.out.print('\n');//Start printing on a new line

 //The next iteration prints even numbers

 for(int i = 0;i<=173;i+=2)

 {

  even=i;

  System.out.format("%.4f",even);//Round to 4 decimal places and print

System.out.print("\t");

 }

 System.out.print('\n');//Start printing on a new line

 double  ssqrt;//Declare ssqrt to calculate the square root of sum of even and odd numbers

 for(int i = 0;i<=173;i+=2)

 {

  ssqrt = Math.sqrt(2*i+1);//Calculate square root here

  System.out.format("%.4f",ssqrt); //Round to 4 decimal places and print

System.out.print("\t");

 }

}

}

Explanation:

Libraries are imported into the program

import java.util.*;

import java.lang.Math;

The following line declares variables even and odd as double

double even,odd;

The following iteration is used to print odd numbers  with in the range of 0 to 173

for(int i = 1;i<=173;i+=2)  {

odd = i;

System.out.format("%.4f",odd); This particular line rounds up each odd numbers to 4 decimal places before printing them

System.out.print("\t"); This line prints a tab

}

The following code is used to start printing on a new line

System.out.print('\n');

The following iteration is used to print even numbers  with in the range of 0 to 173

for(int i = 0;i<=173;i+=2)

{

even=i;

System.out.format("%.4f",even); This particular line rounds up each even numbers to 4 decimal places before printing them

System.out.print("\t"); This line prints a tab

}

The following code is used to start printing on a new line

System.out.print('\n');

The next statement declares ssqrt as double to calculate the square root of the sum of even and odd numbers

double  ssqrt;

for(int i = 0;i<=173;i+=2)

{

ssqrt = Math.sqrt(2*i+1);This line calculates the square root of sum of even and odd numbers

System.out.format("%.4f",ssqrt); This particular line rounds up each even numbers to 4 decimal places before printing them

System.out.print("\t"); This line prints a tab

}

Download java
7 0
3 years ago
What are the 4 main types of parking
erik [133]
Parallel parking, emergency parking, parking on a hill, and prohibited parking. at least that's what the handbook in Arizona says, but check with your state handbook.)
6 0
2 years ago
Your worksheet contains confidential information in column C; to prevent others who use your worksheet from seeing the data, you
emmainna [20.7K]
To prevent others who use your worksheet from seeing the data you can hide column C
5 0
2 years ago
Other questions:
  • What is a function library?
    11·1 answer
  • 8 POINTS!!!!!!!!
    6·2 answers
  • What is a biometric scanner?
    8·2 answers
  • HELP PLEASE
    5·1 answer
  • This method of advertising is expensive but can be the most effective method.
    15·1 answer
  • What do u say to your bf if he says sayy lesssss
    14·2 answers
  • End users have complained that when they click a link on your company's Website, the wrong client loads. You review the page wit
    11·1 answer
  • In an URL what does the domain name describe?
    14·1 answer
  • I still haven't figured out how to award someone branliest will someone help me? If you explain to me how to do it i will do awa
    14·1 answer
  • when I turn on my pc using a graphics card, it does give video, and everything is normal, but when I try to turn on my pc with t
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!