View Single Post
Old Nov 25th, 2006, 3:14 PM   #1
codylee270
Unverified User
 
Join Date: Sep 2005
Posts: 209
Rep Power: 0 codylee270 is an unknown quantity at this point
Need help making a game plan for final programming project!

Ok guys, I'm near the end of my Info. Structures class (very frustrating but definitely worth every penny of tuition). My professor has given us a final project to do and it's an event simulation. Since this thing is incredibly long, I was hoping you guys could help me formulate a game plan to attack the individual segments of this sucker. I'm going to post the prompt for this thing, and at the bottom I'll tell you my ideas of what I'm thinking of doing. If you can think of a better/quicke/ more efficient way of completing some of these tasks, please let me know. I've gotten through almost 3 whole classes with everyone on this forum, lets go out with a bang!

The task:
---------------------------------------------
Background:

MegaStore Market s considering opening a new store in your area and would like you to help create a simulation of the new store. They are planning to have the store open 24 hours a day, so you will be simulating the throughput of customers for a single 24 hour period from time 1 through time 1440 (24 hrs * 60 min/hr). You will be creating an EVENT DRIVEN simulation, so the clock will be updating according to the time of the next event.

Customer Arrivals:

The first step is to create the customers. One suggestion is to create some sort of customer class that will keep a number of different variables for that customer, including their first name, last name, arrival and departure time into each queue, and various information that will help in calculating the simulation statistics.

The owners of MegaStore Market expect that there will be a total of 1000 customers at the store during a 24 hour period. A file containing a list of first names, and a file containing a list of last names will be given to you. You should store these lists locally. Each of the 1000 customers should randomly be given a first name and a last name from these files. In addition, they should be randomly assigned an arrival time into the store (from 1 to 1440), randomly assigned a number of items that they wish to purchase (from 1 to 100), and randomly assigned whether they are paying by cash(20%), check (10%), or credit card (70%).

Events in MegaStore Market:


Every day for the first year, MegaStore Market will have a drawing for $100 in free groceries, with a second prize of $50 in free groceries. 75% of all customers entering into the store will sign up for the sweepstakes, which takes 30 seconds to sign in (plus the time it takes to wait in line - only one person can sign up at a time!!) One lucky winner will be drawn at the end of the day for each of the prizes. You should report who wins as part of your simulation.

Once customers have entered the store and have signed in for the sweepstakes, 40% of the customers will proceed to the deli where they are waited on one at a time. A normal deli operates a first-come, first-served manner, but the owners of the MegaStore decide to switch things up and help the next person based on the alphabetical order of their last name (followed by their first name, if necessary). This way they get to know who their customers are! Each turn at the deli takes 50 seconds (plus the time waiting in line).

After they exit the deli, each customer finished shopping. It takes 11 seconds to shop per remaining item. After they are finished shopping, they may enter one of four checkouts: Express, Cash only (10 or fewer items); Express ( 10 or fewer items); Regular, Cash only; Regular. It takes 3 seconds per item to check out. If they pay by credit card, it takes 30 seconds to finish; and if they pay by check, it requires 75 seconds to finish.

Simulation Statistics:

At the end of the simulation, you should report a number of statistics for each line, including (BUT NOT LIMITED TO): Number processed, average time in line, longest time in line, longest line length. these should be computed for the following: Sweepstakes line, Deli, Express Cash, Express, Regular Cash, and Regular Lines, as well as the statistics for the simulation as a whole (e.g. what are these values for people entering/exiting the MegaStore Market). In addition, you should report the winner of the $100 in groceries.

-------------------------------------------------
So, I'm assuming I need to randomly generate 1000 numbers, b/w 1 and 1440, I'm guessing those should be unique. For the customer names I'll use 2 string arrays, read in each name from the file into an index, probably upon execution of the program (in the main() function).

Looks like I'll need random indices for the names, possibly create a function just for that.
Also need random number generator for number of items to purchase.

I'm not sure what to do about randomly creating the method of payment based on percentage? Anyone have any good ideas?

Also, what should I do about initializing all the cusomters. Should I make the class, as reccomended, and use a loop:

ex.

//Already have random data for arrival time, # of items to purchase
//payment method stored in an array.

for(i=0; i<1000l i++)
{
//Initialize customers
customer c[i](arrival[i], items[i], payment method[i]);
}

So all customers would then have the initial info to begin the sim. Would this work?

Some other questions:
How could I sort the deli queue alphabetically (if last name and first name are each stored in a separate array), using the last name array, and have the associated first name array be changed to reflect the sort. Or if there is an easier way to perfom the deli line queue sort, please let me know. I'm thinking I'll need the full 40% of customers in line before then?

MY BIGGEST QUESTION(S):

How do I keep up will all of the percentages so I can place the customers in the queue properly based on time?
More importantly, how do I keep up with all the times in general so everything goes in order. This seems like the hardest part of the project and, to me, the most confusing.

I'll be checking the forums often today to see everyones' input (if there is any, PLEASE let there be some). I want to get this thing into a nearly whole form of pseudocode before I start coding.

THANKS GUYS!!!!
codylee270 is offline   Reply With Quote