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
Ipatiy [6.2K]
3 years ago
7

g Write a function named distance that takes four parameters: the x- and y-coordinates of the first point, followed by the x- an

d y-coordinates of the second point. It should return the distance between those two points, using the Pythagorean Theorem, for which you will need to import the math module and use the math.sqrt() function.
Computers and Technology
1 answer:
Inga [223]3 years ago
7 0

Answer:

   static double distance(double p1x, double p1y, double p2x, double p2y){

       // distance = sqrt(x2-x1)^2+(y2-y1)^2

       double xcord = Math.pow((p2x-p1x),2);

       double ycord = Math.pow((p2y-p1y),2);

       double distance = Math.sqrt(xcord+ycord);

       return distance;

   }

Explanation:

  • Using Java programming the language
  • Create the function to accept four double parameters x1, x2, y1, y2
  • Calculate the distance based on the formula \sqrt{(x2-x1)^{2}+(y2-y1)^{2}  }
  • Return the distance
You might be interested in
Which of the following correctly revises the passive voice of the sentence above to active voice?
muminat

There is no question on the passive voice, therefore I cannot change it to an active voice.

I hope this helped!

6 0
3 years ago
Write a function PrintShampooInstructions(), with int parameter numCycles, and void return type. If numCycles is less than 1, pr
PSYCHO15rus [73]

// Writing a C++ function

void PrintShampooInstructions(int numCycles){

if(numCycles < 1) // if  condition stands

cout<< "To few";

else if(numCycles >4)

cour<<"Too Many";

else{

// looping the variable for desired out put

for(int i=0;i<numCycles;i++)

cout<<i<<":"<<" Lather and rinse."<<endl;

}

}

6 0
3 years ago
Read 2 more answers
Write an algorithm to find the average of three numbers: 10, 20, 30
STALIN [3.7K]

Language: JavaScript

Answer:

let num = [10,20,30];

average(num);  

function average(num) {

 let sum = 0;

 for(let i in num) {

   sum += num[i];

 }  

 return console.log(sum/num.length);

}

3 0
3 years ago
Which team member on a project typically understands color theory and graphic art? A Art director B Editor CProgrammer D Softwar
Serggg [28]

Answer:

(A) Art Director

Explanation:

The art director will be responsible for all of the visual graphics in a project so they would require knowledge in colour theory and graphic art.

8 0
3 years ago
Consider a byte-addressable computer with 24-bit addresses, a cache capable of storing a
Leto [7]

Answer:

A.

Explanation:

yan Ang sagottt ko yannnnnñnnnnnnnnnnnnn

7 0
3 years ago
Other questions:
  • Automotive engine cylinder heads can be made of what?
    7·1 answer
  • A(n) ________ is a light-sensitive material used to make a chip.
    14·1 answer
  • A portable electronic device that can be used in an emergency to stop someone’s heart from going out of rhythm is called a/an
    6·2 answers
  • Add the function min as an abstract function to the class arrayListType to return the smallest element of the list. Also, write
    15·1 answer
  • 25 POINTS! Complete each sentence to describe the Excel interface.
    12·2 answers
  • Someone once observed that "the difference between roles and groups is that a user can shift into and out of roles, whereas that
    13·1 answer
  • Hey can someone help?
    8·2 answers
  • _________ Code that you write is called primary code, and code that the compiler produces after processing the primary code is c
    14·1 answer
  • . the fact that a web app is written to be run within any of the standard
    5·1 answer
  • What is uncopyrighted software that is given away without cost
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!