Write a method for the queue class in the queue

Assignment Help Basic Computer Science
Reference no: EM131243278

Queues are often used to simulate the flow of people, cars, airplanes, transactions, and so on. Write a program that models checkout lines at a supermarket, using the Queue class from the queue.java program (Listing 4.4). Several lines of customers should be displayed; you can use the display() method of Programming Project 4.1. You can add a new customer by pressing a key. You'll need to determine how the customer will decide which line to join. The checkers will take random amounts of time to process each customer (presumably depending on how many groceries the customer has). Once checked out, the customer is removed from the line. For simplicity, you can simulate the passing of time by pressing a key. Perhaps every keypress indicates the passage of one minute. (Java, of course, has more sophisticated ways to handle time.)

Project 4.1

Write a method for the Queue class in the queue.java program (Listing 4.4) that displays the contents of the queue. Note that this does not mean simply displaying the contents of the underlying array. You should show the queue contents from the first item inserted to the last, without indicating to the viewer whether the sequence is broken by wrapping around the end of the array. Be careful that one item and no items display properly, no matter where front and rear are.

Reference no: EM131243278

Questions Cloud

How did this article fit your ethical view : How does this article contribute to contemporary thinking about business ethics? Assess the ethical issues faced by the business leader or leaders in the article. How can you apply information in this article to your field?
Write a program with a revised priorityq class : The priority queue shown in Listing 4.6 features fast removal of the high-priority item but slow insertion of new items. Write a program with a revised PriorityQ class that has fast O(1) insertion time but slower removal of the highpriority item. ..
How would you implement it to ensure compliance : Why is a code of ethics an important part of every business from an employer standpoint? Why is a code of ethics an important part of every business from an employee standpoint? Once you have written the code of ethics, how would you implement it to ..
Explain how did or will body language impact your perception : Reflect on a lesson that you learned from the ineffective leadership experience which you could apply to similar situations in the future. How did or will body language impact your perception?
Write a method for the queue class in the queue : You should show the queue contents from the first item inserted to the last, without indicating to the viewer whether the sequence is broken by wrapping around the end of the array. Be careful that one item and no items display properly, no matter..
Economy marginal benefit of the public : Suppose a public good is provided in an economy with only two consumers, Popeye and Captain Hook. If Popeye values the public good at $4,000 per year, and Captain Hook values it at $3,000 per year, the economy's marginal benefit of the public good..
How is owning a call option the same as selling a put option : How is owning a call option the same as selling a put option? How is it different? -  An option is far in-the-money and will expire tonight. How would you expect its value to change when the stock price changes?
Implement a priority queue based on a sorted linked list : Implement a deque based on a doubly linked list. (See Programming Project 4.2 in the preceding chapter.) The user should be able to carry out the normal operations on the deque.
Planing a sweatshirt advertising promotion : Casa della Maison Restaurant is planing a sweatshirt advertising promotion. Limited sales data from a few sweatshirt sales of a prototype of the design indicate that

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Determine if the saw horse will stay in position

The coefficients of static friction are shown in the figure.

  Why is this convention critical to the effective use of tree

Why is this convention critical to the effective use of the binary search tree?

  Derive an equation describing the evolution of consumption

Observe that consumption grows at a constant exponential rate. Hence, once we determine its initial level, we have characterized its entire path. Integrating the flow budget constraint and imposing the transversality condition, we obtain

  Distinguish between concurrent and simultaneous

Distinguish between concurrent and simultaneous. A single processor can execute two or more programs concurrently but not simultaneously

  What are some of the more popular database management system

What are some of the more popular database management systems? Why use Oracle?

  How much does the disk slow down the cpu

The CPU normally fetches and executes one 32-bit in- struction every 1 nsec. How much does the disk slow down the CPU?

  What interview techniques do companies employ

Watch the "Interview" video found on the student media website. What interview techniques do companies employ? From your experience, have you been in an interview when these were used? Describe the differences and the approach to being successful ..

  Explaining why facebook-s design is different

Why is Facebook's design different? Or has Google merely perfected something that most organizations have just now started to "tackle"?

  Graph a pair of intersecting lines

(a) Is the system inconsistent, or are the equations dependent, or neither? (b) Is the graph a pair of intersecting lines, a pair of parallellines, or one line? (c) Does the system have onesolution, nosolution, or an infinite number of solutions?

  Articles referencing information security access controls

Research one or more scholarly articles referencing information security access controls

  Design-implement a rmi-based client / server communication

In this assignment, you are requested to build a system which allows a school pupil to practise multiple choice tests in math. Design and implement a RMI-based Client / Server communication system in Java, which will do the following:

  Define a calculatorclass for which the calculator functions

Allow output to be delivered to a variety of targets similar to the way input can be obtained from a variety of sources.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd