Question
Instructions: Write your C# solution and test your program for the specification below Copy and Paste the code for your solution in the places provided
Instructions:
-
Write your C# solution and test your program for the specification below
-
Copy and Paste the code for your solution in the places provided
class GpsLocation{
public double latitude, longitude;
...
}
class OrderedQueue{
// enqueue - Adds a GpsLocation in ascending order by latitude
// dequeue - removes and returns the GspLocation 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 it)
// returns a string list for each gps
}
Class GpsStack{
//push - adds a new GpsLocation to the top of the stack
//pop - removes and returns the GpsLocation at the top of the stack (reurns null if the stack is
empty)
//isEpty - returns true id the stack is empty and false other wise
//peek - returns the GpsLocation at the top of the stack (does not remove it)
}
Class Program{
OrderedQueue q = new OrderedQueue(0, 100);
q.enqueue(26.3, 11.2);
q.enqueue(27.0, 12.98);
q.enqueue(29.67, 9.3);
q.enqueue(28.4, 9.3);
Console.Write(q.printQueue());
// remove each object from the orderedQ and add it to the gpsStack
q.dequeue(1);
q.dequeue(2);
q.dequeue(3);
q.dequeue(4);
// remove each gpsLocation from the stack and print the information (latitude and longitude) of each gpsLocation object after it was removed.
Console.ReadKey();
}
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