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

  Topics you have identified that you did not understand or

1. prepare a reflective essaynbspin which you address each of the following itemsa. descriptions of how you feel you

  What is the purpose of the big-o notation

How many will it do for the average unsuccessful search, assuming that the possibilities of the target. What is the purpose of the big-O notation?

  Write code that will delete the node after the node pointed

Write code that will delete the node after the node pointed to by p2. After this code is executed, the linked list should be the same.

  Why would the relationships be identifying or nonidentifying

Draw the relationships that follow. Would the relationships be identifying or nonidentifying? Why? A patient must be assigned to only one doctor, and a doctor can have many patients.

  Compute the average for each of the usability questions

Compute the average for each of the usability questions in section 2 and present it in a results spreadsheet. Include a couple of analysis statements discussing

  Implement the array list adt using a doubly linked list

Implement the array list ADT using a doubly linked list. Show experimentally that this implementation is worse than the array-based approach.

  What distinguishes sheet metal from foil or plates

Why should we not use the assembly modeling approach to create welded parts as assemblies? Define sheet metal. What distinguishes it from foil or plates?

  Find out whether the list is empty

Write down the functions (in C++) to perform these basic operations on Linked List.

  Write the constructor accessor mutator and tostring methods

Write a client class to test creating Trivia objects. Write the constructor, accessor, mutator and toString methods.

  Create m-file to calculate the future value

Write down M-file to calculate the future value of an initial investment, or the amount that needs to be deposited annually to reach future investment goal.

  Write down a sub query by using the books and publisher

write a sub query using the books and publisher table to list the isbn book title and the retail price for every book

  Why should uninitialized pointers be set to null

Give two reasons why dynamic memory allocation is valuable. Why should uninitialized pointers be set to NULL? What is an alias and why is it dangerous?

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