Create a menu program for the user to test your buffer

Assignment Help Computer Engineering
Reference no: EM131984819

Assignment

In this lab, using C++, you will create two data structures: a stack and a queue. You will use STL containers to demonstrate basic ADTs.

Queue

For the queue, you will simulate a buffer. Remember it is first-in-first-out. The user will enter a number for the number of rounds to run your simulation. You need one function that randomly generates a number. You will also have a user specified percentage, and the function uses this percentage to randomly put the generated number in the buffer. For example, if the user enters 25, then there is a 25% chance of the randomly generated number been put into the queue. You will have another user specified percentage, which is the chance of a value being removed from the buffer. For example, if the user enters 50, then there is a 50% chance of the number in the buffer been removed in this round.

You need to record the length of the queue in each round. After each round of the simulation, calculate and display the average length of the queue. Equation to calculate the average length would be: ALi = (ALi-1 * (i-1) + Li ) / i, where ALi and ALi-1 are the average length in the ith and i-1th round and Li is queue length in the ith round. Does your buffer behave as expected, i.e. get longer if the input chance is greater, and get shorter if the removing chance is greater? Your program needs to handle the situation when the queue is empty and still try to remove a value. You can start the simulation with a queue of certain length.

Stack

Use a stack to create a function that creates a palindrome, i.e. a string that is the same forwards and backwards. It does not need to be an actual word. The function will receive a string from user input and it will return the string with the palindrome. For example, if you enter a string "abc", your program will return "abccba".

Testing program

Create a menu program for the user to test your buffer and to create a palindrome. For the queue, prompt the user to enter the two chances and the total number of rounds. Display the results to the screen in each round. For the stack, prompt them to enter a string. Create the palindrome and then display it. You can determine how this menu program should look like as long as it test the queue and stack properly

What to submit

- Code to implement your stack, both header and source files
- Code to implement your queue, both header and source files
- Code to test the operation of your stack and queue.

Reference no: EM131984819

Questions Cloud

Recovered forth legendary king solomon mines : Allegedly recovered forth legendary King Solomon's Mines, the uncut, rough stone was acquired is 1544 by the scandalous De Luca Family.
Calculate the present value of net benefits for project : Calculate the present value of net benefits for the project using the analysts’ predictions.
Determine the most current maximum and minimum number : Determine the most current maximum and minimum number as the "integer" random numbers are being generated.
How much will you have in the account in eight year : Gold Door Credit Bank is offering 8.2 percent compounded daily on its savings accounts. You deposit $8058 today. How much will you have in the account in 8 year
Create a menu program for the user to test your buffer : Create a menu program for the user to test your buffer and to create a palindrome. For queue, prompt the user to enter two chances and total number of rounds.
Write the lines to determine each of the outputs : Write a program called CountElements: Declare a char array called sentence of 40 elements and assign. Write the lines to determine each of the outputs.
Release of particles from the sun : Add Missing apostrophes- Astronomers are telling people to be especially watchful this evening, as a rare event could be making a very special appearance.
How you would modify a dfa which accepts l : You can do this by describing how you would modify a DFA which accepts L so that you get another DFA which accepts L - {?}.
Can someone correct the wrong tense the correct verbs : We arrive in the middle of a thunderstorm at one in the morning. I take the tent out of the car and try to pitch it, only to then that we had forgotten the pegs

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