Answered step by step
Verified Expert Solution
Link Copied!

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.

  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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Are they working longer hours? Bringing more work home?

Answered: 1 week ago

Question

What is the environment we are trying to create?

Answered: 1 week ago

Question

How would we like to see ourselves?

Answered: 1 week ago