Question: a) Given the following Java application program segment, draw the diagram of Q after the code segment is executed. Label the front and rear position

 a) Given the following Java application program segment, draw the diagramof Q after the code segment is executed. Label the front and

a) Given the following Java application program segment, draw the diagram of Q after the code segment is executed. Label the front and rear position of the diagram public class test 1 public static void main(String [] args) Queue Q = new Queue (); Object front; Q.enqueue ("green"); Q.enqueue ("blue"); Q. dequeue (); Q.enqueue ("red"); front - Q.getFront (); Q. dequeue (); (1.5 marks) b) Given the following Queue and vehicle ADT classes below: class Vehicle private String vehicleName; private String vehicleType; private String vehicleRegistrationDate; private double vehiclePrice; //Exora, Myvin, X50 //MPV, Sedan, SUV //ddmmyyyy //RM40000, RM170000 Definition of other methods including normal constructor, mutators, accessors and tostring(). class Queue public Queue () {-} public void enqueue (Vehicle data) {-} public Vehicle dequeue () ...) public boolean isEmpty) ... RSWZ Used Car company uses a system to store and keep track of its used car's record by using the queue data structure. Assume that the data have been stored into a queue named queuevehicle, answer the following questions. Find and display how many used cars were registered in the year 2017. (Note: In order to avoid data loss, use a temporary queue to store the information.) (4.5 marks) Move all Exora cars which priced less than RM170,000.00 into queue Exora while the other Exora cars remain in the original queue. (4 marks) ii. a) Given the following Java application program segment, draw the diagram of Q after the code segment is executed. Label the front and rear position of the diagram public class test 1 public static void main(String [] args) Queue Q = new Queue (); Object front; Q.enqueue ("green"); Q.enqueue ("blue"); Q. dequeue (); Q.enqueue ("red"); front - Q.getFront (); Q. dequeue (); (1.5 marks) b) Given the following Queue and vehicle ADT classes below: class Vehicle private String vehicleName; private String vehicleType; private String vehicleRegistrationDate; private double vehiclePrice; //Exora, Myvin, X50 //MPV, Sedan, SUV //ddmmyyyy //RM40000, RM170000 Definition of other methods including normal constructor, mutators, accessors and tostring(). class Queue public Queue () {-} public void enqueue (Vehicle data) {-} public Vehicle dequeue () ...) public boolean isEmpty) ... RSWZ Used Car company uses a system to store and keep track of its used car's record by using the queue data structure. Assume that the data have been stored into a queue named queuevehicle, answer the following questions. Find and display how many used cars were registered in the year 2017. (Note: In order to avoid data loss, use a temporary queue to store the information.) (4.5 marks) Move all Exora cars which priced less than RM170,000.00 into queue Exora while the other Exora cars remain in the original queue. (4 marks)

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!