Question: 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.

  1. 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

  1. Print if the following locations exist in the OrderedQueue:

Latitude

Longitude

12.2

11.2

27.0

12.98

29.67

9.8

  1. Print all the items in the OrderedQueue.
  2. Paste your code for Part3 here:

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!