1. BurritoBrothers - Shop can be shared by multiple customers at a time, with a limit on total number of customers. Counter Semaphore can be used to keep check on number of customers getting entry into Burrito Brothers shop. Per problem counter semaphore should be initialized to 15.
Per problem counter semaphore should be initialized to '3'.
b. Secondly, a binary semaphore to keep track whether a customer is being served by a Server or not. This will avoid customer thread to gain access of multiple counters at a time.
3. Cash Register - Like Counter location, cash register is also shared by customers. Since, there exist a single cash register and only one customer can access it at given moment. A binary semaphore can be used to control customers waiting to pay from paying together, but would ensure they pay one by one.
So, four different semaphores are needed to handle concurrency of Customer and Server as per given problem.
Both, Customer and Server extend Thread class. However, both classes have different sets of responsibilities.
1. Step in to Burrito Brothers shop, if there is space available.
2. After stepping in, wait till customer becomes a customer with smallest order in waiting Area.
3. Once, customer becomes the customer with smallest order aquaire a free counter.
4. Leave counter and join waiting Area.
5. If more burritos are needed keep performing steps 3 & 4.
6. If order is complete wait for cash register to get free.
7. Once cash register is free leave waiting Area and acquire cash register.
9. Leave cash register.
10. Leave Burrito Brothers.
1. Wait for customer to serve.
2. Once customer is at counter, prepare three or less burritos.
3. Handover them and again go to step 1.
Additional, two classes are needed in the solution which are not mentioned in class diagram.
1. CustomerGenerator - A class to generate new customers with random orders.
2. World - A class which creates...
Since, there exist a single cash register and only one customer can access it at given moment. A binary semaphore can be used to control customers waiting to pay from paying together, but would ensure they pay one by one.
Since, customer with smallest order needs to get change to aquireCounter first Waiting Area is implemented as TreeSet which automatically sorts objects, if object implements Comparable interface. Customers just need to check whether they are first in Tree Set to know whether they are eligible to acuire Counter Location, if available.
World.log("Admitted one customer " +customer.getCustomerName() + ", additional space for " + customerSemaphore.availablePermits() + " customers available. Waiting area consits of " + customersWaitingForBurrito.toString());
World.log(serverName + " made " + burritosToMake + " burritos for " + customerToServe.getCustomerName() + ", customer still requires " + (customerToServe.getOrderBurritoCount() - customerToServe.getAcceptedBurritos()) + " burritos."); ...
Cite this document
(“Programming Project in Java Assignment Example | Topics and Well Written Essays - 2000 words”, n.d.)
Retrieved from https://studentshare.net/miscellaneous/273651-programming-project-in-java
(Programming Project in Java Assignment Example | Topics and Well Written Essays - 2000 Words)
“Programming Project in Java Assignment Example | Topics and Well Written Essays - 2000 Words”, n.d. https://studentshare.net/miscellaneous/273651-programming-project-in-java.
The technique has been used extensively by business managers around the world to solve complex problems. Because of its simplicity, the technique has been gaining popularity. This report analyses the benefits and limitations of dynamic programming and at the same time it explains the technique with the help of an example.
Similarly, pick a node front of queue; if unvisited, we visit the node and again place its neighbors in the queue.
Contrary to BFS, DFS involves following the path in the graph as deep as possible. If there are no unvisited, adjacent nodes, then we backtrack to the previous level and start traversal again.
Print out the document when completed and hand it in by the end of TUESDAY of week 11. Marks will be deducted for poor presentation.
Extensions will only be given in exceptional circumstances (such as those that would constitute Anglia mitigation) and will not be given for bad time management on your part.
The finally block is also a requirement as it let go of resources when needed. It is executed prior in the try/catch/finally block, and the statements within it will always be executed. It does not depend on whether the block
The ubeefx later on capitalized on the idea after numerous sessions of brain storming discussions that saw the successful completion of the entire leisure project current known as “Magarena”. The now few years project, dates back to June 2009 and
The author provides an analysis and comparison of the features of the models. The software component models define and explain not only the software components but also the rules for integration and composition mechanism. Based on the analysis and comparison, the report ends up with a thorough evaluation of the models using figures and tables.
Basically, the serialization mechanism involves creation of bytes sequence that contains the objects data together with information about the type of data being stored in the object and the objects’ data. The process of