I'm trying to design a code using class methods and functions
In this question you are asked to write a console application to test a class which has been supplied by the course team. The library TMAs2005.lib contains the definition of a class Q4Queue. This class is intended to simulate a queueing system which works as follows.
Customers join a single queue to be served at a counter. There are two counters, the first of which is always open. Counter 2 is opened if the number of customers waiting in the queue is four and another customer arrives. When one customer departs from a counter, the customer at the head of the queue (if any) leaves the queue and goes to the empty counter. However, if the queue drops back to no waiting customers and a customer departs from Counter 2 then this counter will close again.
A typical dialogue from your program might include something like that shown below. The user’s choice of event — ‘A’, ‘1’ or ‘2’ — is shown in this output at the end of each prompt. Note how the prompt does not list option 2 when Counter 2 is not busy. Likewise option 1 would not be listed whenever Counter 1 is not busy. The opening and closing of Counter 2 is not explicitly mentioned in the dialogue.
...
Queue Length = 3
Counter 1 busy
Counter 2 closed
Select next event. . .
A = Arrival of customer
1 = Customer departs from Counter 1
A
Queue Length = 4
Counter 1 busy
Counter 2 closed
Select next event. . .
A = Arrival of customer
1 = Customer departs from Counter 1
A
Queue Length = 4
Counter 1 busy
Counter 2 busy
Select next event. . .
A = Arrival of customer
1 = Customer departs from Counter 1
2 = Customer departs from Counter 2
1
Queue Length = 3
Counter 1 busy
Counter 2 busy
Select next event. . .
A = Arrival of customer
1 = Customer departs from Counter 1
2 = Customer departs from Counter 2
...
The documentation provided by the author of the class, which gives prototypes
of the public methods with comments, is as follows. This information
should be all that you need to make use of the class.
void Initialise(void);
// Initialises
a
Q4Queue object with queue of
zero
length,
// Counter 1
not
busy and Counter 2 closed.
void Arrival(void);
// Updates the queue length and states of the
two
counters
// to simulate the arrival of a customer.
void LeaveC1(void);
// Updates the queue length and states of the
two
counters
//
to
simulate the departure of
a
customer from Counter 1.
void LeaveC2(void);
// Updates the queue length and states of the
two
counters
//
to
simulate the departure of
a
customer from Counter 2.
bool GetC1(void);
// Returns true if Counter 1 busy; false otherwise.
bool GetC2(void);
// Returns true if Counter 2 busy; false otherwise.
int GetQ(void);
// Returns the length of the queue.
Your task is to design and write a program to test the class along the lines
of the sample dialogue above. Your program should include calls to each of
the listed methods.
[SIZE=7]can some one help me understand the steps to doing this? or any other help wpuld be appriciated.
thanks