Programming II Checkout line simulation

Assignment: Write a simulation of a checkout line. The interval between arrivals anddepartures and the duration of the simulation are given in the input file. The
input file is specified in the section titled Input File and sample input file is
shown in figure 1. The output file contains a record of the simulation and
can be used to compare expected values for the simulation with actual
values produced by the simulation. The output file is specified in the section
titled Output File and a sample output file is given in figure 2. Please note
that values produced by the simulation will probably not match values
shown in figure 2 due to the random nature of distribution sampling.
Employ classes Uniform, Exponential, ExponentialElapsed, and Event as
defined in files given below. Employ file p05make to create executable file
p05.
Prohibition: Use of the C++ Standard Template Library is prohibited in the
implementation of this project.
Program Files: Project 5 consists of files p05.cpp, Sim05.h, Sim05.cpp, Uniform05.h,
Uniform05.cpp, Exponential05.h, Exponetial05.cpp,
ExponentialElapsed05.h, ExponentialElapsed05.cpp, Event05.h,
Event05.cpp, Queue05.h, and p05make. Project file names are exactly as
given. Failure to employ the foregoing names will result in a score of zero
(0) for this project
Project files must be stored in the root directory of your student account.
Failure to store project files in the root directory of your student account
will result in a score of zero (0) for this project.
File Description
p05.cpp File p05.cpp contains functions that process
command line arguments and manage the
checkout line.
Sim05.h File Sim05.h contains the definition of class
Sim. Class Sim defines private data and
member functions specific to the simulation.
Class Sim employs a uniform distribution to
determine arrival and departure times.
Sim05.cpp File Sim05.cpp contains the implementation
of member functions of class Sim.
Available in
~tt/cs2613
Uniform05.h File Uniform05.h contains the definition of
class Uniform. Class Uniform defines
attributes of the uniform distribution.
Available in
~tt/cs2613
Uniform05.cpp File Uniform05.cpp contains the
implementation of member functions of class
Uniform.
 

File Description
Available in
~tt/cs2613
Exponential05.h File Exponential05.h contains the definition
of class Exponential. Class Exponential
defines the attributes of the exponential
distribution. The times between arrivals and
departures are drawn from the exponential
distribution.
Available in
~tt/cs2613
Exponential05.cpp File Exponential05.cpp contains the
implementation of member functions of class
Exponential.
Available in
~tt/cs2613
ExponentialElapsed05.h File ExponentialElapsed05.h contains the
definition of class ExponentialElapsed. Class
ExponentialElapsed defines the attributes of
a sequence of samples drawn from the
exponential distribution. A sample from the
exponential elapsed distribution is the sum of
the intervals of a sequence of samples drawn
from the exponential distribution.
Available in
~tt/cs2613
ExponentialElapsed05.cpp File ExponentialElapsed05.cpp contains the
implementation of member functions of class
ExponentialElapsed.
Available in
~tt/cs2613
Event05.h File Event05.h contains the definition of class
Event. Class Event defines the attributes of
sequence of events. An event is either an
arrival or a departure. The time of the event
is the elapsed time since the simulation start.
Class event merges two sequences of elapsed
times drawn from the ExponentialElasped
distribution. One sequence is the sequence
of arrivals: the other sequence is the
sequence of departures.
Available in
~tt/cs2613
Event05.cpp File Event05.cpp contains the
implementation of member functions of class
Event.
Queue05.h File Queue05.h contains the definition of
template class Queue. Class Queue
implements a queue by dynamically
allocating individual elements of a queue.
Elements of the queue can have any type T.
Elements are linked from oldest to newest.
Elements are dynamically allocated when
needed and discarded after they are no
longer required.
Available in
~tt/cs2613
p05make File p05make contains instructions for
creating executable file p05. Instructions in
file p05make are accepted by the UNIX utility
make.
 

Command Line: Project 5 can be invoked with zero, one, or two program parameters. The
first program parameter is the input file name. The second parameter is the
output file name. Sample command lines together with corresponding
actions by program p05 are shown below. Boldfaced type indicates data
entered at the keyboard by the user.
$ p05
Enter the input file name: i05.dat
Enter the output file name: o05.dat
$ p05 i05.dat
Enter the output file name: o05.dat
$ p05 i05.dat o05.dat
Input File: The input file contains three (3) simulation parameters as shown in Figure
1. All parameters are given in minutes. The first parameter is the mean time
between arriving customers. The second parameter is the mean time
between departing customers. The third parameter is the duration of the
simulation. You may find simulation parameters given in Figure 1 in file
i05.dat in the class directory (~tt/cs2613/
Simulation
parameter
Type Units Description
Arrival
interval
double Minutes Specifies the average time between
arrivals.
Departure
interval
double Minutes Specifies the average time between
departures.
Duration int Minutes Specifies the length of the simulation.
Figure 1.
Input file format: 0.5000 0.3333 100000
 

Output File: The format of the output file is shown in Figure 2. Data shown in Figure 2 is
produced by Program p05. The output file consists of three (3) columns. The
first column contains a description of the data shown. The second column
lists data produced by program p05. The last column lists the units of the
data recorded in the second column. The widths of the columns are 40
spaces, 10 spaces, and 20 spaces respectively.
Column Specification
1 (left) Text is left justified in a field of 40 spaces.
2 (middle) Integer data are right justified in a field of 10 spaces.
3 (right) Text is right justified in a field of 20 spaces.
Figure 2.
Output file
format:
Mean time between arrivals 0.50 minutes
Arrival rate 120.00 customers/hour
Mean time between departures 0.33 minutes
Departure rate 180.02 customers/hour
Expected response time 1.00 minutes
Response time variance 3.00 minutes
Simulation response time 0.96 minutes
Expected line length 2.00 customers
Line length variance 6.00 customers
Simulation mean line length 1.90 customers
Customers served 19741 customers
Simulation maximum response time 8.90 minutes
Simulation maximum line length 17 customers
Simulation lasted for 9999.74 minutes
 
Powered by