Question: This is a Java question. (12 points) Write a class Airport. An airport has the following private fields: An int indicating the x-coordinate of the
(12 points) Write a class Airport. An airport has the following private fields: An int indicating the x-coordinate of the airport on a world map with a scale to 1 km. An int indicating the y-coordinate of the airport on a world map with a scale to 1 km. An int indicating the airport fees (in cents) associated to this airport. The class must also have the following public methods: A constructor that takes three int as input indicating the position of the airport on a map (x and y coordinate) and the fees of the airport in cents) respectively. The constructor uses the inputs to initialize the corresponding fields. A getFees method to retrieve the fees of the airport. A static method getDistance which takes as input two airport and returns a integer indicating the distance in kilometer between the two airports. Note that the method should round the distance up (e.g. both 5.9 and 5.2 should become 6). More over, remember that given two points (1,9) and (22,42), the distance can be computed with the following formula: distance = (1-2) + (y1 - y2)2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
