Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

c++ Queue Simulator (cinema booking ticket)

$
0
0
Part 1 involves C++ class and its properties (inheritance, composition etc) which I have completed. I definitely can post the codes here but I think it is highly unnecessary? The question here is how to implement the "queue simulator" part of the question? I have two ideas as stated, but I am highly in doubt with that two ideas. I am hopeful for someone with experience to drop a few comments on the ideas mentioned above, or better, a different idea to tackle the question Part 2. I'm pretty new to C++, my scope of knowledge (& thus what the question requires) should be limited to beginner's

note: Do have a look and vote for reopen. I have edited in hope to make the inquires clearer.

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.

Problem Statement
    
    You are hired to develop a sales system for cinema ticket and a simulator for queuing. The business
    rules are listed below:
    
    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.



My question:
What is the correct algorithm to tackle Part 2?

My ideas :

1. First is, Save all records into a file so that two instances of the program can access the file. Is this possible?

2. 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? can we have somewhere in the program, an interrupt mechanism to prompt for adding a customer into queue while it is running on different sections of the program?

is there any other method/algorithm?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>