Question: Need help with java program, please explain it. I'm having a hard time doing it A restaurant wants a system where their serving staff can

Need help with java program, please explain it. I'm having a hard time doing it

Need help with java program, please explain it. I'm having a hard

A restaurant wants a system where their serving staff can bring orders for dishes back to the kitchen. Each dish is represented by a particular integer, and the system would store a sequence of orders for the cooks to complete from start to finish. Normally, servers would put new dishes at the back of this sequence, while cooks would read from the front, but occasionally a server would need to place a rush order at the front of the sequence so that it will be the next one the cooks complete. You'll be in charge of writing a class that stores this sequence of integers in a data structure, along with the functions that let the servers add new dishes to the front or back and cooks to take them off of the front. You're not in charge of the user interfaces that the cooks and the servers will use to access your system, unfortunately, and your teammates in charge of each interface made different assumptions about what your structure will look like. Your teammate who's working on the user interface for the servers wants to interact with a Deque. That way, they can give the servers a default option for adding new orders to the back of the sequence, and another for adding them to the front if they're a priority order. As such, their interface code is expecting to see the functions of a Deque. Your other teammate who's working on the user interface for the cooks, however, was expecting a simple Queue. They've already written their code for dequeing from the front of a queue, and are expecting to see that function. Neither of them want to change their existing design, so it's up to you to build an object that can be called on as both a Deque and a Queue. To simplify the problem a little, you are not required to make your code compatible with a particular Java Queue or Deque class or interface, you can make your own version of either/both in the process of solving this question, just so long as each adheres to the expected methods for their respective ADT. You must submit one Java file, though it may include more than one class. The test file must demonstrate the same object being treated as both a Queue popping numbers off the front and as a Deque adding numbers to both the front and back. The test should interleave these function calls to prove that they are accessing and modifying the same base object. Your written answer for this question should include an asymptotic run-time analysis for each function. If the worst-case run time for any of your functions is different than it would be for that data structure's usual methods under its ADT, you should note it and explain why. Otherwise, your answer should walk through how your code addresses the needs of the scenario. A restaurant wants a system where their serving staff can bring orders for dishes back to the kitchen. Each dish is represented by a particular integer, and the system would store a sequence of orders for the cooks to complete from start to finish. Normally, servers would put new dishes at the back of this sequence, while cooks would read from the front, but occasionally a server would need to place a rush order at the front of the sequence so that it will be the next one the cooks complete. You'll be in charge of writing a class that stores this sequence of integers in a data structure, along with the functions that let the servers add new dishes to the front or back and cooks to take them off of the front. You're not in charge of the user interfaces that the cooks and the servers will use to access your system, unfortunately, and your teammates in charge of each interface made different assumptions about what your structure will look like. Your teammate who's working on the user interface for the servers wants to interact with a Deque. That way, they can give the servers a default option for adding new orders to the back of the sequence, and another for adding them to the front if they're a priority order. As such, their interface code is expecting to see the functions of a Deque. Your other teammate who's working on the user interface for the cooks, however, was expecting a simple Queue. They've already written their code for dequeing from the front of a queue, and are expecting to see that function. Neither of them want to change their existing design, so it's up to you to build an object that can be called on as both a Deque and a Queue. To simplify the problem a little, you are not required to make your code compatible with a particular Java Queue or Deque class or interface, you can make your own version of either/both in the process of solving this question, just so long as each adheres to the expected methods for their respective ADT. You must submit one Java file, though it may include more than one class. The test file must demonstrate the same object being treated as both a Queue popping numbers off the front and as a Deque adding numbers to both the front and back. The test should interleave these function calls to prove that they are accessing and modifying the same base object. Your written answer for this question should include an asymptotic run-time analysis for each function. If the worst-case run time for any of your functions is different than it would be for that data structure's usual methods under its ADT, you should note it and explain why. Otherwise, your answer should walk through how your code addresses the needs of the scenario

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!