assignment instructions: a sushi preparation and
delivery system.
A new sushi delivery business has just been opened in a
busy university city. This business keeps stocks of
ingredients sourced from local suppliers and uses these to
prepare different types of sushi dishes. Each of these
sushi dishes is prepared according to a recipe that
specifies which ingredients (and how much) to use. Due to
significant and predictable demand from the student
population, the business also keeps stocks of prepared
sushi. Stocks of ingredients and prepared sushi are always
kept at specific target levels set by the business.
What sets this business apart from other similar
competitors is a fleet of delivery drones (small
autonomous aerial vehicles). These fulfil two purposes:
they deliver prepared sushi dishes to the customers and
they collect new ingredients when stocks are low.
Your objective in this coursework is to implement an
inventory and delivery management system for the sushi
business. This will keep track of stocks of ingredients and
the sushi that has been prepared from these ingredients.
It will also manage the fleet of drones for delivering sushi
and restocking ingredients. Finally, you will implement a
client application that customers can use to view the
range of sushi on offer, to place orders and to view the
progress of their order.
Part One (Ingredients, Suppliers and Sushi Dishes)
Write classes to represent ingredients, their local suppliers
and sushi dishes. An ingredient should have a name, a
unit in which its quantity is typically measured (such as
grams or litres) and a supplier. The supplier has a name
and a distance to the sushi business. You can assume
each ingredient is sold by exactly one supplier, and one
supplier could sell multiple ingredients. Each sushi dish has a name, a description, a price and a set of required
ingredients and corresponding quantities (its recipe).
Part Two (Stock Management)
Write appropriate classes to keep track of ingredients and
prepared dishes that are currently held in stock by the
business. For each ingredient and dish, there should be a
restocking level. Falling below this level means that new
ingredients should be ordered or new dishes should be
prepared (you will implement this in a later part).
Part Three (Kitchen Staff)
Write a KitchenStaff class that represents a member of
the kitchen staff and that can be run as a Java Thread.
When running, an instance of this thread should monitor
the stock levels of dishes. Should any fall below their
restocking levels and there are sufficient ingredients to
satisfy the recipe of the dish, the thread should prepare a
new dish (using up the required ingredients). This should
take a random amount of time between some specified
lower and upper bounds (for example 20-60 seconds).
Make sure all your classes are synchronized appropriately,
so that multiple kitchen staff threads can operate
concurrently.
Part Four (Communication Layer)
Write a class Comms that handles communication
between the business (stock management) application
and the client applications. Provide a 'sendMessage'
method (or methods) that allows each client to send a
message object to the business application and the
business application to send a message to a specific client.
The applications will also need to check for incoming
messages by calling a 'receiveMessage' method (or
methods) of the Comms class. The types of these may
vary depending on the types of message being
sent/received. For the purposes of this assignment, you may assume
that the business and client applications run on the same
machine and communication may be achieved by making
use of the local filesystem. For example, messages sent
by the business can be stored in 'mailbox' style
file(s)/folder(s) dedicated to a particular client. A separate
file/folder could be used for the business application.
If you prefer you may use Socket communication in the
Comms class instead of files. In either case, the business
and client applications should be oblivious to the actual
communication mechanism used. That is, all I/O
operations must reside in the Comms class. Access to
them is only allowed via your send/receive methods
above.
Part Five (Client Application)
Write a client application that customers can use to order
sushi from the business. New users should be able to
register with a username, password, an address, and a
choice from a list of pre-defined postcodes that are served
by the business. Existing users should be able to log in
with their previously chosen username and password.
When logged in, the application should show all available
dishes, including current stock levels. Customers should
be able to add/remove dishes to/from a shopping basket,
view the current total price and place their order. They
should also be able to see the status of current and
previous orders.
Communication with the business application (for example
to register users, to retrieve available dishes and place
orders) should be implemented using the Comms class
and appropriate message types.
Part Six (Drones) Write a Drone class that represents a delivery drone with
a specific flying speed and that can be run as a Java
Thread as part of the business application. A drone should
monitor stock levels of ingredients. When these drop
below their restocking levels, it should collect further
ingredients from the appropriate supplier. The time it will
take for this will depend on its speed and the distance to
the supplier. When it is not collecting stocks, a drone can
also deliver customer orders. You can assume a fixed
distance for each customer postcode, and along with the
speed of the drone, this will determine the delivery time.
Again, ensure your classes are appropriately
synchronized, so that multiple drones can run
concurrently.
Part Seven (Business Application)
Write an application for the sushi business. This should
allow the user to:
• view current stock levels (of ingredients and dishes),
• change restocking levels,
• add or edit ingredients, suppliers and dishes,
• view the status of customer orders,
• remove specific orders (and cancel them if
necessary),
• remove all completed orders,
• view the status of kitchen staff and drones, and
• add or remove kitchen staff and drones.
The business application should also communicate with
the client applications by listening to messages and
sending appropriate responses.
Part Eight (Persistence Layer)
Provide a service class DataPersistence that provides
functionality to ensure that all data stored in the system is
stored on disk in case the business application needs to be restarted at some point. This should include user data,
stocks, dishes and orders. You should store information
about the kitchen staff and drones (but it is permissible to
reset any partially completed activities).
Modify your business and client application to make use of
your DataPersistence class.