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 five second time steps. Each cashier is able to process one item every five seconds. During each five 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:

Design Steps

  1. Write a list of all the nouns and noun phrases from the program specification above. Circle entries that are good candidates for classes, underline entries that will need to be represented in the program, but should not be classes, and cross out entries that do not need to be represented in the program.
  2. Draw a largish 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.
  3. 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?
  4. 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.