Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: 2. Copy 3. Upload 4. B your solution and test your program for the specification below and Paste the code for your solution in

image text in transcribedimage text in transcribed

Instructions: 2. Copy 3. Upload 4. B your solution and test your program for the specification below and Paste the code for your solution in the places provided to blackboard (you may submit as many ties as you wish. Only the last submission will be marked) e cautious not to share your solution with others. It will resuit in a zero mark. Part 1: Create a class GpsLocation that has two double values namely latitude and longitude. Both are public and no constructor is needed s lock Part 2: Create a class OrderedQueue which has the following operations: enqueue- adds a GpsLocation in order by latitude. dequeue -removes and returns the GpsLocation at the head of the queue isEmpty- returns true if the queue is empty and false otherwise peek -returns the GpsLocation at the top of the queue, null if there is none(does not remove printQueue -returns a string with the information for each GpsLocation object in the queue The class OrderedQueue MUST be implemented as a linked list. Note: a Node class must be mad Part 3: Create a class GpsStack which has the following operations push-adds a new GpsLocation to the top of the stack pop -removes and returns the GpsLocation at the top of the stack (returns null if the stack is empty) isEmpty - returns true if the stack is empty and false other wise peek-returns the GpsLocation at the top of the stack (does not remove it) e The class stack MUST be implemented using an array of size 100 Instructions: 1. Write you solution and test your prngiam for the specification below 2 Copy and Paste the code for ynu' solution in the plares provided 3. Upload to blackboard Ivou mav submit as manv ties as vuu wish. Onlv the ast submission wil be marked) re to search 2 Part 4: a) Write a main program that adds the following gpsLocations to the OrderedQueue in the following order Order of adding to Queue Latitude 26.3 27.0 29.67 28.4 Longitude 11.2 12.98 9.3 9.3 2 4 b) Remove each object from the OrderedQueue and add it to the GpsStack. c) Remove each Gpslocation from the stack and print the information (latitude and longitude) of each GpsLocation object after it was removed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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