Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network

  Advanced Search  

CS 428/528 Lab 2: Concurrent Network Fun October 31 pm, other than Part 1 which is due Oct. 17

Summary: CS 428/528 Lab 2: Concurrent Network Fun
October 31 pm, other than Part 1 which is due Oct. 17
Overview and Description
In this project, we will implement a simulation of your startup GreenTomatoes, best known
for multi-colored ketchup. You will write one program to simulate the sales server of GT
and another to generate orders to it.
The server will have two UDP sockets from which it could receive purchase orders, one
for retail customers, and another from bulk customers like restaurants and grocery shops.
You dont know when each will receive orders. Retail customers pay $8 per case, while bulk
customers pay $6. The cost of a case to you is $5. The individual customer orders are for a
number of cases uniformly distributed (i.e., use a random number generator to get the order
size) between 1 and 20. The bulk order sizes are uniformly distributed between 10 and 100.
A transaction is initiated by sending a message to the sales socket, including the number of
cases to be bought.
Assume that your intital inventory of ketchup cases is 400 cases (that is the size of your
warehouse). Every time you receive an order, decrement your inventory. It takes 50msecs to
process individual orders, and 100 msecs to process bulk orders; after waiting this time, you
can and send a message back to the buyer delivering the cases. If not enough inventory is
available, you have to wait for more inventory to arrive. When the inventory gets low, you
should order more cases (remember that the cost of a case is $5). It should take 5 seconds


Source: Abu-Ghazaleh, Nael B. - Department of Computer Science, State University of New York at Binghamton


Collections: Computer Technologies and Information Sciences