Question: 0 1 . 0 2 . Calculate closer distance Problem Statement 0 2 You are given a function, int Distance ( int Ax , int
Calculate closer distance Problem Statement You are given a function, int Distance int Ax int Ay int Bx int By; The function accepts the coordinates of truck AAx Ay and the coordinates of truck BBx By as input. The office is at location Implement the function to determine which truck is closer to the office by comparing the square of their distances. Return the square of the distance of the truck which is closer to the office. Square of distance between two points having coordinates x y and : Distancex y Note: No need to compute the square root of the distances of trucks A and B from the office. If both trucks are at equal distance, return square of distance of either truck. Example: Input: Output: Explanation: Distance of truck AAx AyDistance of truck BBx By Since, hence the output is ample input ple Output
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
