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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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