// main.C: the file containing the main() function. (modified)

#include <iostream.h>
#include "supermarket.h"
#include "arrivalEvent.h"
#include "endsimEvent.h"
#include "reportEvent.h"

// Here is the actual definition of the global variable declared in
// "main.h". It is instantiated within the function main().

SupermarketSim *sim;

int main()
{
   // Read data and print introduction.
   cout << "Enter: <report interval><endingtime><seed1><seed2><num express>"
      "([1,19])\n";
   cout << "Sample input: 100 1200 1 1 10\n";

   double reportInterval;
   cin >> reportInterval;
   reportInterval *= 60; // convert to seconds

   double endTime; // How long should the simulation run?
   cin >> endTime;  
   endTime *= 60; // convert to seconds

   unsigned long seed1,seed2;
   cin>> seed1>>seed2;
   cout<<"\nRandom seeds are: "<<seed1<<" "<<seed2<<"\n";

   int numExpressCashiers; 
   cin >> numExpressCashiers;

   // Simulation parameters
   // CODE: do complete analysis for each variation of mean
   // inter-arrival time equal to 8, 9 and 10 seconds.
   const double meanInterArrivalTime = 8;
   const int maxExpressItems = 10;
   // Fraction of customers that will go to an express cashier
   const double expressCustomerRatio = 0.3; 
   
   // Create a simulation object.
   sim = new SupermarketSim( reportInterval, endTime, meanInterArrivalTime,
			     seed1, seed2,
			     numExpressCashiers, maxExpressItems,
			     expressCustomerRatio );


   cout << "\n          ******* Supermarket Simulation *********\n";
   cout << "\nMean interarrival time = "
	<< meanInterArrivalTime << " secs\n";
   cout << "\nTotal number of cashiers = "
	<< sim->getTotalCashierCount()
        << " (" << numExpressCashiers << " are express)\n";

   // Start simulation
   sim->start();

   // Clear up
   delete sim;
   
   return 0;
}
