StudentShare solutions
Triangle menu

Programming Project in Java - Assignment Example

Nobody downloaded yet

Extract of sample
Programming Project in Java

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.

Use cases:-


Class Diagram:-

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.
8. Pay.
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."); ...Show more


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.
Author : lenore42
Programming Project in Java essay example
Read Text Preview
Save Your Time for More Important Things
Let us write or edit the assignment on your topic
"Programming Project in Java"
with a personal 20% discount.
Grab the best paper

Check these samples - they also fit your topic

Project planning and implementation
Managerial Process Plans 7 2.1 Project Tracking Plan 8 2.1.1 Requirements Management and Schedule Control 8 2.2 Risk Management Plan 8 2.3 Project code of practice 9 3. Technical Process Plans 12 3.1 Methods, Tools, and Techniques 12 3.2 Infrastructure 12 3.3 Product Acceptance 12 4.
11 pages (2750 words) Assignment
Dynamic Programming: Resource Allocation
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.
3 pages (750 words) Assignment
Game Programming
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.
10 pages (2500 words) Assignment
Systems Programming
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.
4 pages (1000 words) Assignment
Linear Programming
The model has been solved using excel solver and the optimal solution is obtained. Further, a sensitivity analysis has been used to consider the impact of capacity increase on profitability. The
5 pages (1250 words) Assignment
Java assignment
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
1 pages (250 words) Assignment
A letter in favor of your proposed changes to Magarena
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
1 pages (250 words) Assignment
The software architecture

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.

12 pages (3000 words) Assignment
Programming III ( Advanced )
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
3 pages (750 words) Assignment
Java Programing
Java language omits many rarely used, poorly understood, confusing features found in other programming languages. Java does not need a lot of training to
6 pages (1500 words) Assignment
Hire a pro to write
a paper under your requirements!
Win a special DISCOUNT!
Put in your e-mail and click the button with your lucky finger
Your email
Comments (0)
Click to create a comment