Bonus Practice Sheet Winter 2018 [17-Mar-2018 to 7-Apr-2018]
Program ID- 2742
Design a class point with datamembers: name of the point(string), value of the x-coordinate and the value of y-coordinate. Here, value of the x-coordinate and the value of the y-coordinate should be an even integer. Provide functions to get the details of a point, print the details of a point and a function to compute the squared distance between the point and a given point(passed to the function as an argument). Design a class mobileSpace, with a list of points(both the coordinates must be even integers) that represent the position of the mobile towers and a point that represents the position of mobile phone. With the position of the mobile towers and mobile phone given as input, provide member functions to get the details and determine the tower with which the mobile phone can be connected based on the `longest squared distance between the phone and the tower’ Use STL for implementation.
Input Format
Number of towers, ‘n’
Name of tower1
X-coordinate of tower1
Y-coordinate of tower1
…
Name of tower-n
X-coordinate of tower-n
Y-coordinate of tower-n
Name of mobile
X-coordinate of mobile phone
Y-coordinate of mobile phone
Output Format
Name of the tower to which the phone has to be connected
Input Format
Number of towers, ‘n’
Name of tower1
X-coordinate of tower1
Y-coordinate of tower1
…
Name of tower-n
X-coordinate of tower-n
Y-coordinate of tower-n
Name of mobile
X-coordinate of mobile phone
Y-coordinate of mobile phone
Output Format
Name of the tower to which the phone has to be connected
Please Comment Working if the code worked to you
If you have other working codes please comment the codes enclosing with <pre> and </pre>
Example: <pre> Your Code </pre>
Code: C++
NOTE: The Above Codes are for reference only. It doesn't mean everyone to directly copy/paste those codes.
No comments:
Post a Comment