Simulate the biscuit pan with a computer program

Assignment Help Computer Engineering
Reference no: EM132188671

Work with the Stack data structure and explore the idea of first-in, last-out (FILO).

Imagine that you're visiting a local all-you-can-eat breakfast bar; among the many items on the bar is a pan of biscuits.

Your task is to simulate the biscuit pan with a computer program.

Note that when new biscuits are added to the pan, they're always added to the top (the worker just dumps new biscuits on top of the old biscuits); also note that whenever someone takes a biscuit to eat, they pick the top-most biscuit.

Thus we've got a stack (first-in, last-out) and the bottom-most biscuit is always the oldest. For sake of simplicity, imagine that the pan only allows you to select a "top" biscuit (i.e. you can't pick among many).

The task is to utilize a stack collection. Your program should allow the user to add a biscuit, remove a biscuit, and print the status of the stack. The stack should store the time in which the biscuit was added; and when a biscuit is removed, the program should display how long the biscuit "lived" in the pan (i.e. the difference from now to when it was added to the pan).

Important items to consider:

Don't allow the user to remove (pop) a biscuit if the pan is empty

Displaying the status of the stack should show how many biscuits are in the stack and the "age" of the topmost biscuit

Use the Stack class to make your job a LOT easier (otherwise, you must implement the stack class yourself).

To get the time in Java, import java.util.* and then make use of the Date class

Reference no: EM132188671

Questions Cloud

Display the total price of the hotel stay : You work for a local hotel chain and have been tasked with coding a program that calculates the cost of a user's hotel stay depending on room choices.
What factors would influence you : You work as one of five senior networking engineers in a large insurance company with 500 small offices located across the United States.
Create a class with instance methods withdraw : Each Class should have a unique account number and a current balance (use a static variable to store lastAccountNumber).
Study the variation in chicagos temperature : If the temperature never increased, then report that. Give a O(n log n) algorithm for this task.
Simulate the biscuit pan with a computer program : Imagine that you're visiting a local all-you-can-eat breakfast bar; among the many items on the bar is a pan of biscuits.
In your own words what is a data structure : Provide an example application for which a list is appropriate. Please be sure to provide details with your application.
Oral style of speaking and a written style of communicating : What are the key differences between an oral style of speaking and a written style of communicating?
What is the best way to learn the difference : What is the best way to learn the difference between high-context and low-context styles?
Achieve effective intercultural communication : Identify three skills that are necessary to achieve effective intercultural communication as a provider in a healthcare setting

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write a function alllntersect

Modify ShowFmins so that for a given starting value, it reports the number of iterations required when Fmins is run with steptol = ftol = lO-d for d = 0:6.

  What is the meaning of data setup time

The 68000 bus cycle lasts (4 + n)t, y , seconds, where n i s the number o f pairs o f wai t stat e s introduced. This expression implies that you can increase.

  Based on tests of the chevrolet cobalt engineers have

based on tests of the chevrolet cobalt engineers have discovered that miles per gallon in highway driving are normally

  Describe the data security and disaster recovery

Describe the Data Security and Disaster Recovery. Design a suitable program for the development, implementation, testing and maintenance of Incident Response.

  Describe python modules and packages

Describe Python modules and packages

  Which web server has proven most popular

Which web server has proven most popular since the dawn of the web? Describe what it means to scale web services vertically and horizontally. Explain why you might choose each depending on your environment and requirements.

  Benefit and drawback of each major operating system

Benefit and drawback of each major operating system

  What is the running time complexity of your function

What is the running time complexity of your function ? Justify

  Symptoms of group think would they most likely display

which of the following symptoms of Groupthink would they most likely display?

  Write a program which makes a grade book

Reads from an input file using file i/o 20 names(can use first names but make them distinct) and the corresponding grades(grades are between 0 and 100- make several with the same grade).

  Questionwrite down a program that declares a vector of ten

questionwrite down a program that declares a vector of ten floating-point values. have program prompt the user for

  Explain what is an affiliate program

Describe what is an affiliate program, and how it works. explain the advantages and disadvantages of using an affiliate program. Give some examples of successful affiliate programs.

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