Program to use a stack to represent list of workers

Assignment Help Programming Languages
Reference no: EM1352727

A company has six hiring positions with more people wanting jobs than the number of available positions. The company managers decide in order to give more people an opportunity to make money; they will allow people to work in three-month intervals. The first six people on the waiting list will be hired in the order that they are on the waiting list. The first six people will keep these positions for three months. At the end of three months, the manager will roll a dice to determine the number of people who will lose their jobs. The company will use the policy of last-hired-first-fired. For example, if the dice roll is 3, the last 3 people hired will lose their jobs to the first 3 people on the waiting list. People losing their jobs will be placed on the back of the waiting list in the order that they are fired. This process will continue for every three-month interval.

Write a program to simulate this process. Use the following guidelines.
- Use a stack to represent the list of workers.
- Use a queue to represent the list of people waiting to work.
- Simulate a manager rolling a dice by randomly generating a number 1 through 6. Note: Use the C++ function - rand(). (To use this function you may need to include <stdlib.h> or <cstdlib>.)
- At the end of each three-month interval, show the dice value, the worker's list in the order from last hired to first hired, the waiting list in order of first to last.
- Ask the user if they want the see the workers list and the waiting list at the end of the next three months. Program ends if the user does not want to see any more.

Sample input: Ask the user for the number of people needing jobs. This number must be greater than 6. Using that number, randomly generate the list of ID numbers for the workers. An ID number should be greater than or equal to 100 and less than 1000. Make sure no two workers have the same ID. (Hint: Use the following to generate an ID number: ID = 100 + rand()% 900.)

Reference no: EM1352727

Questions Cloud

Explain and identify three arguments and three non-arguments : Explain and Identify three arguments and three non-arguments you encountered today.
What rate reported by statistics canada every month : Which of the following is NOT a shortcoming of the civilian unemployment rate reported by Statistics Canada every month.
Calculate the maturity risk premium : Kelly Corporation five year bonds yield 7.50% and 5-year T-bonds yield 5.80%. The real risk-free rate is r* = 2.5%, the default risk premium for Kelly's bonds is DRP = 0.40 percent,
Illustrations of language aphasias : What are some examples of language aphasias? How do language aphasias help physiological psychologists understand the production and comprehension of language?
Program to use a stack to represent list of workers : Write a program to simulate this process. Use the following guidelines.- Use a stack to represent the list of workers. Use a queue to represent the list of people waiting to work.
Find default risk premium on corporate bonds : Assume 10-year T-bonds have a yield of 5.30% and ten year corporate bonds yield 6.80%. Also, corporate bonds have a 0.25% liquidity premium versus a zero liquidity premium for T-bonds,
Cognitive development-influence on language acquisition : Cognitive development in the brain has the largest influence on language acquisition, because variations in the initial brain structure can make qualitative differences in language acquisition.
What does this normally mean upward-sloping supply curves : If a price in a competitive market is "too high to clear the market," what does this normally mean. Assume upward-sloping supply curves.
First instruction executed if we start machine with counter : Suppose the memory cells at addresses 00 through 02 contain the following bit patterns. What would be the first instruction executed if we start the machine with its program counter containing 00?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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