home

=__**BuyRite Supermarket**__=

__**-> Customer Class**__
The customers will be split into 4 categories: Quick (just passing through for a few items), Family (the once per fortnight shop for a family household), Professional (the adults only household), Novice (not really used to doing the shopping). In each of the 4 categories of customer there will be 3 operations and 13 objects, which can be seen in the UML diagram below and then described further down.



- CalculateHappiness: In this operation, the happiness of the customer will be calculated. - CalculateSearchTime: In this operation the search time of the customers as they search around the story is calculated. This information will also be used when judging customer happiness. - Checkout: The checkout is where the items a customer has in their shopping list are transferred to the till. The customer passes the number of items to checkout from the Till class (which can be seen in more detail below). The LengthofQueue is then calculated and will be used to workout the speed at which the items will be scanned. This length of time will be passed back to the customer class, and this is the time the customer waits.
 * Operations**

 - Customer ID - int: Each customer will have a unique customer ID so that they can be individually processed in the store. The customer ID will be given to customers when they are created as they come in the shop. It allows us to pin point individuals which will be better for our research. - Patience level - double: This is a constant that is given to the customer when the customer type is calculated by the system. - Concentration - double: This is similar to patienceLevel, in that it is also a constant given to the customer when the customer type is calculated. - Dawdle time - int: A constant given to the customer when the customer type is decided. - Time spent in store - int: This is calculated when needed using the operation in simulator TimeSinceRun. - Happiness - int: Happiness is calculated when the customer leaves the store. It is calculated using the formula f = l/(l + q), where l is the total length of time spent in the shop before joining the queue and q is the amount of time spent queuing. - Willing to wait - int: This is calculated as the customer joins the queue; it is the amount of time the customer is willing to wait before they will leave the store. It is calculated using q = l/p, where l is the length of time spent in the shop before joining the queue and p is the patience factor. - Promotion probability - double: The promotion probability is a constant with value depending on which type the customer is. - Response to promo - boolean: This will be calculated when the item basket is being created for the customers. It will return true or false depending on what the algorithm gives. - Shopping List - array: This is the array of items that the customer is purchasing. - Time entered - oat: This is the time the customer rst entered the store. It is needed to know how long the customer has spent in the store.
 * Objects**

__**-> Tills Class**__
The Till class is set up with 2 objects and 3 operations. This can be seen below, with each being described.

**Operations** - Assign staff: This operation will assign a staff member to a till. These staff members may either be Experienced or Training. The user will input the values for the number of staff that are available, their type and the number of tills in use. The type of staff sent to each till would depend on the type of till, with less experienced staff preferred on express tills and experienced staff preferred on normal tills. - Checkout: Manages the array list of customers items. This information will better help us to classify particular customers into their types and will in turn make the research more reliable. - Add customer: There will be a shared queue, where the first customer in the queue will get allocated to the next available till. There will be an array list QueuePosition displaying each customers position in the queue.

- Till ID - int: This is the unique ID given to each till. It is given to the tills as they are created. This will allow us to keep track of the number and types of open tills. - lengthOfQueue - int: Each till has its own queue length and this is stored in this integer.
 * Objects**

__**-> Checkout Staff Class**__
Checkout Staff are split into two types; Experienced and Training. The type of staff member will influence how fast checkouts are run and which checkout the staff member will be working on. There is 1 object and 1 operation for each staff type.

-Calculate checkout speed: When assessing the speed of a checkout, we must first take into account the LengthofQueue. Once this has been calculated we should look at the staff type working on a till, assuming that a trainee will work slower than an experienced staff member and vice versa.
 * Operations**

- Staff ID - int: This is a unique ID given to each staff member. Much like the CustomerID and TillID, this will increment by 1 for each new staff member added, it will allow us to keep track of the number of staff working.
 * Objects**

__**-> Items Class**__
The Items class is used to determine what type of shopper the person is and therefore how quickly they will shop and how quickly they will want to shop etc. By looking at specific items bought we are able to categorize people in a more efficient way. The Items class is made up of 4 objects and 1 operation.

**Operations** - Add to basket: This operation will add the item to a shopping list in the customer class. This will be an array of length decided as the customer walks in, depending upon the size of the generated shopping list.

- Item code - int: This is the code of the item. It will be an auto-incrementing number starting from 1. It will be used to reference items using just the code. - Item type - String: This is what type of item that it being purchased for example either Luxury or Essential - Item price - double: This is the amount payable by a customer for a particular product. - Promo item - double: This will be either true or false, depending on whether the item is on promotion or not.
 * Objects**

__**-> Simulator Class**__
This class is the most important part of the system. It can take the current time, form the computer, set tills, create customers, produce graphs, update the system, set promotion and set opening hours of the supermarket.

- TimeSinceRun: This operation takes the current time from the computers clock, minus the recorded time when the simulator was last run. - SetTills: This takes the user input, which specifes the amount of tills operating in the supermarket. The user will also specify the amount of regular tills and the number of express tills. If these do not add up to the total number of tills an error message will be displayed. - CreateCustomer:This method generates an instance of customer along with its type, either being :professional, family, novice or quick. There will be a twenty five percent chance that each of these types can be chosen randomly. - ProduceGraph: There will be a bar graph which shows the number of each item that has been purchased. The second graph is a line graph, this takes the QueueTime from the customer class and represents the amount of time each customer spent queuing. The third graph shows the average amount of time that each type customer spent in the store. This is represented via a bar graph. Thus it will contain four bars and allows comparisons to be made easily. - Update: In each class the update method will be used differently. The function of this operation is to allow the separate classes to keep in sync with one another while the simulation is running. - SetPromotion: The user has the option to select the products which are on promotion. This method applies the changes in price. - SetOpeningHours:This method is provided by the user, and specifes how long the shop is open each day.
 * Operations**

- Running Time - float: This is the amount of time that has passed since the program was started. - Profit - float: This is the total profit the shop has made since the simulation began. - numberOfCustomers - int: This will be used to keep track of how many customers are actually in the store at the present time. It will start at 0, and increase by 1 for every customer that enters the store, and decrease by 1 for every customer that leaves. - numberOfStaff - int: This tells the system how many staff are working at a particular point in time.
 * Objects**

__**-> User Class**__
This class is the basic controls for the simulator and allows a user to edit information and run the program how and when they please

**Operations** - PauseSim: This operation will pause the simulation in its current state, should the user need to look at what is currently happening or attend to business and wish to resume the current simulation at a later time. It also gives the possibility to generate the graphs part the way through a simulation to see the current affects. - RunSim: This operation is used for first running the simulation when the program has been opened and resuming the simulation if the PauseSim operation has been called.

__**User Stories**__
---> 1) As a quick shopper, I want more less than 10 item tills open so I can leave quicker

---> 2) As a family shopper, I want an experienced staff member working my till so I can pay and leave quicker

---> 3) As a novice shopper, I want staff working on the shop floor so I can be directed to the items I need.

---> 4) As a professional shopper, I want to be able to use self service tills so I can leave quicker.