C++ Queue Simulator

Based on the question below, I have finished Part 1 of the Sales System. Going into Part 2, there are things that I don't really get.

My ideas :

First is, Save all records into a file so that two instances of the program can access the file. The thing is, it does not 'click 'with the requirement. We can't access a file by 2 programs simultaneously, can we?

Second, create an "in-program" queue - where only an instance of the program is run and queue could be a simple array or LinkList. What I don't get is, when/how to create and store the customer on that queue? The program need to be interrupted to prompt for adding a customer into queue (while it is running)? it just does not make any sense to me...

Any other ideas? or perhaps some comment in implementing my ideas? thanks

Problem Statement

You are hired to develop a sales system for cinema ticket and a simulator for queuing. The business
rules are listed below:

Code:

Part 1 Sales System (13 marks):
All tickets are priced at RM10 per person.
There are 3 types of customers:
Non-member: No annual fee, do not enjoy any discount or benefit.
Gold member: RM10 annual fee, enjoy a 10% discount for every ticket purchased.
Platinum member: RM50 annual fee, enjoy a 20% discount for every ticket purchased and
get a free ticket for every 5 tickets purchased.
Part 2 Queue Simulator (2 marks)
There are 2 sale counters serving one queue. Your program may start (and loop) by asking the
user to choose one of the following 3 options:
A customer joins the queue.
Counter 1 takes the next customer.
Counter 2 takes the next customer.
For every option selected, your simulator should list following:
The queue.
The customers already served by the counters.
The customers currently being served by the counters.

I don't think you need two programs or shared memory, although that scheme could work. I would maintain a queue of customers awaiting service. And a loop.
At each iteration {
Some probability for a new customer to joins the queue.
If counter 1 is open it handles a customer*.
If counter 2 is open it handles a customer.
}

The service time is sampled from a distribution.
The probability for a customer to join the queue comes from some distribution.

Does the employee at counter 2 get a 15 minute break?
Do diners arrive faster at noon than at 2PM?

I don't think you need two programs or shared memory, although that scheme could work. I would maintain a queue of customers awaiting service. And a loop.
At each iteration {
Some probability for a new customer to joins the queue.
If counter 1 is open it handles a customer*.
If counter 2 is open it handles a customer.
}

The service time is sampled from a distribution.
The probability for a customer to join the queue comes from some distribution.

Does the employee at counter 2 get a 15 minute break?
Do diners arrive faster at noon than at 2PM?

That sounds like implement-able. I will try working on it. Btw I will update the post with codes of my program to make it clearer how suitable it is to implement the "queue simulator"

hmmm, however I look at it, it make sense if I write another program to call the previously written program (part 1)...making the queue simulator now as the main program...is that what you have in mind?

I don't think you need two programs or shared memory, although that scheme could work. I would maintain a queue of customers awaiting service. And a loop.
At each iteration {
Some probability for a new customer to joins the queue.
If counter 1 is open it handles a customer*.
If counter 2 is open it handles a customer.
}

The service time is sampled from a distribution.
The probability for a customer to join the queue comes from some distribution.

Does the employee at counter 2 get a 15 minute break?
Do diners arrive faster at noon than at 2PM?

As far as i can read, it sounds more it is the user that decide when a new customer arrive and when a customer get to a counter.

something like this:
user action: join a customer to the queue -> 1 customer in queue, 0 customer currently served at counter, 0 customer already been served
user action: join a customer to the queue -> 2 customer in queue, 0 customer currently served at counter, 0 customer already been served
user action: counter 1 takes next customer -> 1 customer in queue, 1 customer currently served at counter, 0 customer already been served
user action: counter 1 takes next customer -> 0 customer in queue, 1 customer currently served at counter, 1 customer already been served
etc..

Since you know how to find items off queues, with a pop or look method, I thinking that you didn't read the entire link I provided at post 5. Click the underlined text.

I did read and I think I understand the 'points' of the post. The 2nd page's were right on.

However, it seems that I have mistakenly bring ups some wrong ideas here. In relation to my ideas in the first post, given some times, I think I would be able to tackle the question, of course with research and stuff.

what I want is the 'right' way to tackle the question.....programming wise, from you all experts and much well knowledgeable than me.

btw, at the end, I did implement some simple queue (just another array of class object) on top of the program, with 2 'simultaneous' users, within the same program.