Bob's Grocery Mart
Introduction
Bob's Grocery Mart has 73 locations distributed across 12 States. Bob
would like to increase the profitability of his stores by improving
cashier scheduling: If too few cashiers are scheduled, customers
become frustrated and may not return to the store. With too many
cashiers, Bob pays more wages than necessary. You have been tasked
with writing a checkout simulation program that will be used to
analyze the impact of increasing or decreasing the number of cashiers.
Program Specification
Your program should simulate the activity of any number of staffed
check-out aisles in a Bob's Grocery Mart. The simulation will proceed
in one-second time steps. It takes between one and five seconds for a
cashier to process a single object. During each one-second interval
there is a .5% chance that a new customer will finish shopping and
enter a checkout aisle. Customers purchase between 1-100 items. If
there are any empty aisles, customers choose one arbitrarily. If all
aisles are occupied, customers choose the aisle with the shortest
line. The program should simulate a single eight hour shift. At the
end of the simulation the program should display:
- The total number of customers served.
- The average wait time across all customers.
- The maximum wait time for any individual customer.
Design Steps
- Underline all of the nouns and noun phrases from the program
specification above. Circle entries that are good candidates for
classes and cross out entries that are duplicates or do not need to be
represented in the program. Any remaining underlined words should
represent entities that do need to be represented in the program but
should not be classes.
-
Draw a largish UML box for each of the classes that you selected in the
previous exercise. In the upper part of the box, list an appropriate
set of attributes along with their types. Think about fields that
constitute the persistent state of an object vs. values that make more
sense as local variables.
-
In the lower part of the box, List the necessary constructors for your
Classes, along with the required arguments. Does it make sense to
have a default constructor? Are there classes that may need more than
one constructor?
-
For each class list an appropriate set of methods. Think about the
parameters and return types for each. Think about which methods
should be public, and which are only needed within the class.
-
Once you are satisfied with your design, (and you have cleared it your
instructor) create .java files for each of your proposed classes.
Include Javadocs containing the authors, version, and a description of
the class. Add the necessary instance variables and method stubs to
your classes. You do not need to provide the code for your methods,
but you should include a brief Javadoc comment for each.
-
Submit your .java files through Canvas.