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

  Draw the stack frame as seen by the subroutine

You are required to save and restore any accumulators and/or registers used by the subroutine (other than A).

  Working with cross-functional teams and offshore teams is

working with cross-functional teams and offshore teams is common in large it project deployments. similarly your

  Build a rails application that constructs a database

Build a Rails application that constructs a database with a single table listing well-known players from some specific team sport.

  What techniques are supported for developing programs

What tools and techniques (for example, Unicode data types and string tables) are supported for developing multilingual programs?

  What are an ethical dilemmas associated

What are the ethical dilemmas associated with using facial recognition software? Is this kind of software any different from a store asking to see your drivers license when you use your credit card.

  Consider a system that consists of five processes

Consider a system that consists of five processes. Process 0 generates random integers and send them to process 1.

  Recall the optimal page replacement algorithm

The victim page chosen by the algorithm is the one that will not be used the longest period of time. Can this algorithm exhibit Belady's anomaly?

  1 design a program that reads in a text file with drawing

1. design a program that reads in a text file with drawing commands and then outputs a bitmap with all the items drawn

  Can a company make a change on classified information

Are there any differences between classifying governmental information and commercial information?

  How can atomic broadcast be used to manage group membership

How can atomic broadcast be used to manage group membership? When a computation runs for a long time, it is sometimes wise to make checkpoints periodically.

  Explain what means that bitmapped image is device-dependent

Explain what it means that bitmapped image is device-dependent. Identify the connection between device-dependence and spatial resolution.

  What types of translations are possible

What are the three categories of relationships in ER diagrams? What distinguishes relationships in "roles" from all other relationships in an ER diagram?

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