Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ASAP JAVA Bassed. Create a class GpsLocation that has two double values namely latitude and longitude. Both are public and no constructor is needed. Create
ASAP
JAVA Bassed.
Create a class GpsLocation that has two double values namely latitude and longitude. Both are public and no constructor is needed.
Create a class OrderedQueue which has the following operations:
- enqueue- adds a GpsLocation in order by longitude and Latitude (ordered by the sum of the longitude and latitude).
- search take two double values long and lat and returns true if a GpsLocation with these values exists in the queue . This must use a binary Search implementation. You may assume that no two GPSLocations will have the same sum of Lat and Long.
- printQueue returns a string with the information for each GpsLocation object in the queue.
The class OrderedQueue MUST be implemented as an Array of size 100.
- Write a main program that adds the following gpsLocations to the OrderedQueue in the following order.
Order of adding to Queue | Latitude | Longitude |
1 | 26.3 | 11.2 |
2 | 27.0 | 12.98 |
3 | 29.67 | 9.3 |
4 | 28.4 | 9.3 |
- Print if the following locations exist in the OrderedQueue:
Latitude | Longitude |
12.2 | 11.2 |
27.0 | 12.98 |
29.67 | 9.8 |
- Print all the items in the OrderedQueue.
- Paste your code for Part3 here:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started