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

  Eliminate the problem of unutilized empty slots

Write an algorithm that implements the shift right operation as used in linear queues to eliminate the problem of unutilized empty slots created after deletions.

  Give the boolean equation for the problem

Develop a truth table that captures the desired circuit behavior of the problem and give the Boolean equation for the problem.

  Identify the population-the units

In each of the following situations, identify the population, the units, each variable, and tell if the variable is categorical or quantitative. If it is quantitative, then identify it further as either discrete or continuous.

  Create a testbench to test the description

Create a testbench to test the description, testing load, clear, simultaneous load/clear, and holding the register value.

  Can anybody give me a snippet or a little guide

I need to calculate the hash of the file that its path is stored in fpath variable.I think it can be done via GetHashCode. Can anybody give me a snippet or a little guide?

  Who should be involved in environment and network design

Who should be involved in environment and network design?

  The motherboard is a volatile or non-volatile storage

The motherboard is a volatile or non-volatile storage unit and what does in control?

  Discuss some of the dangers of having remote access

Discuss some of the dangers of having remote access users and some methods used to mitigate those issues. What is the preferred standard for remote access authentication?

  The lisp function length counts

The Lisp function LENGTH counts the number of elements in the top level of a list. Write a function ALL-LENGTH of one argument that counts the number of atoms that occur in a list at all levels.  Thus, the following lists will have the following A..

  Describe the social implications of gaming

Within 500 words, describe the social implications of gaming. Besides entertainment, think of other aspect of our society that can be affected by gaming.

  Supply and demand curve for bicycles

What happens in a supply and demand curve for bicycles when a video showing a terrible bicycle crash goes viral?

  Sort the array into descending sequence

Call an iterative sum method to sum the values in the array. Print this total and use it to desk check the total developed by the recursive sum method.

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