I\'m trying to write simulation program for waiting in a line. I have most of th
ID: 3631911 • Letter: I
Question
I'm trying to write simulation program for waiting in a line. I have most of the classes coded (minus some empty methods in a couple) and some pseudo code for the main program written. I'm looking for help filling in the empty methods and writing the program using the pseudo code.
I have all the code posted on pastebin: http://pastebin.com/k1XMXkGT
This is the pseudo code:
// Simulation Pseudo Code
public class SimulationProgram
{
//member variables
private static int simulationTime;
private static int numberOfServers;
private static int transactionTime;
private static double arrivalProbability;
create customer wait queue
create server list -- specify # of servers
foreach( clock time unit )
{
update servers
update customer wait queue
if( customer arrives )
{
create customer record
( cust#, clock, waitTime=0, transactTime )
add customer to wait queue
}
if( free server )
{
remove customer from wait queue
add customer to server
}
generate statistics report
}//end foreach
}//end class SimulationProgram
Explanation / Answer
#include #include #include #include using namespace std; class queue { int a[20]; int h,t; public: queue(); void enqueue(int); int dequeue(); int isempty(); int isfull(); }; queue::queue() { t=1; h=t; } int queue::isempty() { return(h==t?1:0); } int queue::isfull() { return(t+1==h?1:0); } void queue::enqueue(int i) { if(!isfull()) { coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.