Add 10 people to the line

Assignment Help C/C++ Programming
Reference no: EM13161124

Simulation of DMV queue Use the dynamic queue class to simulate customers arriving at the DMV and being serviced.

Customers arrive at random intervals. Each will be given a ticket with their name, a number and a time stamp. The customer will enter the queue to wait to be served. When a customer is served, they are taken out of the queue.

The DMV service agent will process this person for a certain amount of time and then go on to the next person.

In order to simulate the time of arrival of customers and the time of processing, you will need to use the localtime function, a wait function, and a random number generator. The random number should be between 1 and 5. Add customers to the queue by using a random number generator to choose a random number between 1 and 5.

Use this number as a parameter to the wait function. When the wait function ends, add them to the queue. When there are customers waiting, the DMV service agent function should dequeue a customer, generate a random number between 1 and 10 and use this number as a parameter to the wait function simulating the processing time for that person.

The process function will then need to find the time the person waited by calling the time function and finding the difference between the start and end timestamps. Save this time to an accumulator so that in the end you can find the average wait time for all customers.

Add 10 people to the line and process them. Each time you process someone, print out their ticket information. After all 10 have been serviced, print the average wait time. Below is an example of the time calls you will need and a wait function.

#include
#include
using namespace std;
void wait ( int seconds );
int main()
{
   
    wait(5);
   
    time_t rawtime;
    struct tm * timeinfo;

    time ( &rawtime );
    timeinfo = localtime ( &rawtime );
    cout << timeinfo->tm_hour<< ":" << timeinfo->tm_sec;
   wait(5);
    time ( &rawtime );
    timeinfo = localtime ( &rawtime );
    cout << timeinfo->tm_hour<< ":" << timeinfo->tm_sec;

    return 0;
}
void wait ( int seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLOCKS_PER_SEC ;
while (clock() < endwait) {}
}

Reference no: EM13161124

Questions Cloud

Briefly describe the process to separate the two ions : The two ions are mixed in a solution and you need to pick a chemical to add that would allow you to selectively remove one of them. Briefly describe the process you would use to separate the two ions.
Provide the rtl instructions : Provide the RTL instructions and the time steps that will facilitate the execution of the following assembly language instructions  LDA addr,x  STX addr,x
Briefly explain how a penetration tester could assess risk : Briefly explain how a penetration tester could assess the risk involved with identified vulnerabilities.
What is the relative fitness : Dwarfism is an inherited condition. 108 dwarfs produced 27offspring, while 457 non-dwarfs produced 582 children. What's the relative fitness?
Add 10 people to the line : Add 10 people to the line and process them. Each time you process someone, print out their ticket information. After all 10 have been serviced, print the average wait time. Below is an example of the time calls you will need and a wait function.
Define what nacl concentration : What NaCl concentration results when 219 mL of a 0.740 M NaCl solution is mixed with 492 mL of a 0.350 M NaCl solution?
Article and your own research : Using the above article and your own research, write a 3- to 5-page paper comparing 3-4 of the operating systems you find in the readings and other materials from your research. Compare both technical and non-technical features and explain what you b..
Write a program called word guessing game. : Write a program called Word Guessing Game. Open the file FourLetterWords.txt and write the contents into an array of Strings (the file has 87 words in it).
State what was the initial concentration of hcl : What volume of NaOH is needed to reach the end point of the titration? What was the initial concentration of HCl?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c program that reads a data file of floating numbers

Write a program that reads a data file of floating numbers into an array and prints the array elements along with the number of items in the array

  Implement the guess the word

Implement  the ‘Guess the Word' game in an object-oriented manner

  Write program to declare the array of type float

Write down the c++ program which declares the array of 50 components of type float. Initialize array so that first 25 components are equal to square of the index variable.

  Write test program to call function several times for gcd

Greatest common divisor of two integers is largest integer which will evenly divide both integers. Implement this function in assembly language and write test program which calls function several times, passing it different values.

  rewrite that statement in a more readable style.

Give an example statement in C, C++, or Java that is particularly unreadable. Rewrite that statement in a more readable style.

  Write application which ask user to input grades of students

Write C++ application which asks user to input grades for 5 student (3 grades each) save them in five double one dimensional arrays (one array for each student),

  Write a program using vectors and iterators

Create a program that uses at least two functions that will be called from your main. This program is a number game program that asks for parts of your phone and after manipulating it mathematically, eventually outputs your entire phone number. The d..

  C assignment of curl library

C Assignment Curl library must be used To be done on linux, it should be compiled using the following command: gcc -Wall -ansi -pedantic NameOfFile.c -lncurses Please make sure it is commented with clarification Variable names in camel case

  Maze program

Maze program. In this assignment you will represent a maze with a binary tree. . The starting point is node N and the ending point is node Z.

  Perform operations on arrays

Perform operations on arrays execute tests and repetitions

  If a class is derived protected

If a class is derived protected from a base class, explain how this affects the inheritance of all public, protected, and private members of the base class by the derived class.

  Write a bouncing ball video game

The balls bounces within the screen where the two horizontal walls are fixed

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