Question: Exercise 5 . 5 The distance between two points ( x 1 , y 1 ) and ( x 2 , y 2 ) is

Exercise 5.5 The distance between two points (x1, y1) and (x2, y2) is
Distance =
p
(x2 x1)
2+(y2 y1)
2
Please write a function named distance() that takes four doubles as parametersx1,
y1, x2 and y2and that prints the distance between the points.
You should first write a function called sumSquares() that calculates and returns the
sum of the squares of its arguments. For example:double x = sumSquares (3.0,4.0);
would assign the value 25.0 to x.
The point of this exercise is to write a new function that uses an existing one. You
should first write the sumSquares function then use that function in your distance
function. Write a main function that tests each function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!