The process function will then need

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

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.

The time code below should help me with this process but I'm still very confused:

#include <ctime>

#include <iostream>
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: EM13160995

Questions Cloud

Generate a sphere of diameter 3. create 3 vectors : Generate a sphere of diameter 3. Create 3 vectors representing the translation of this sphere along the x, y, and z axes. Generate the correct vectors given the description below: The sphere should be translated to (-10, -10, -10).
Describe the phenomenon of convergence : Describe the phenomenon of convergence in the vertebrateretina. Why is this important to us?
Retrieves a student name and three scores : Write an application that retrieves a student name and three scores per line from a text file. Process the values by calculating the average of the scores per student. Write the name and average to a different text file. Test your application with a ..
What is the difference between the scenario : One of the reasons that people also sleep with their mouthsopen-causing snoring- is sleep apnea. This can also be a very dangerous condition requiring some sort of treatment.
The process function will then need : 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 tim..
Economic and social impoverishment of the maasai people : Land loss has been the most important factor responsible for the ongoing economic and social impoverishment of the Maasai people. The Maasai believe that restoring their land and livestock economy is the only sustainable solution to elevate poverty a..
O create a variable called nickname which has a nickname : 1.  Show the steps to create a variable called NICKNAME which has a nickname for you in it; make this variable available to the environment
What are yearly duration of daylight for quito : what are yearly duration of daylight for quito, ecuador(on equator), and for Mazatlan, mexico(on tropic of cancer)?
File format would you choose : What file format would you choose for the following tasks: 1. A cartoon strip 2. A 3D model for use on a multimedia presentation on the web

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Distinguish syntax and purpose of while-loop and for-loop

Distinguish the syntax and purpose of while-loop and syntax of a for-loop. Give C++ code examples of both loops and descriibe the main differences.

  Create the appropriate constructor, getters and setters

Create the appropriate constructor, getters and setters for the class. Create an instance of Student for each of the students listed above from array. Construct the instance with lastname, firstname, and job.

  Implement the tronomino tiling algorithm

Implement the tronomino tiling algorithm,  our program should take an arbitrary input positive integer  k  in the Linux command line and generate a 2 k  * 2 k  board.

  Complete the design and implementation

Complete the design and implementation of the class customerType defined in the Programming Example Video Store. b. Design and implement the class customerListType to create and maintain a list of customers for the video store.

  Write program which reads n numbers from keyboard

Write down C++ program which reads N numbers (positive, negative, integer and double numbers) from keyboard, computes and shows the following information. Largest number of all numbers entered from keyboard.

  Program to output value of tenth component of array

Write a C++ statements to perform the following: Set value of fourth component of array alpha to three times  value of eight component minus 57.

  Implement method to advance any given date by one day

Write C++ implementation of this method. Create and specify any other methods that you require. Include comments which will be helpful to someone who will maintain implementation in the future.

  By a minimal interpretation that makes a formula

By a minimal interpretation that makes a formula true, we mean that if one atom is removed from the interpretation then the resulting interpretation does no longer make the formula true.

  Write a c program which takes a string from command line

Write a c program which takes a string from command line with mainfunction has no parameter and convert the string in upperca

  Create class integerset

Create class IntegerSet for which each object can hold integers in the range 0 through 100. Represent the set internally as a vector of bool values. Element a[i] is true if integer i is in the set. Element a[j] is false if integer j is not in the set..

  Program to translates letter grade into number grade

In C++ (should be able to compile in Visual Studio 2010): Write a program to translates letter grade into number grade. Letter grades are A,B,C,D and F, possibly followed by a + or -.

  Develop a simple poker game

Develop a simple poker game

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