8000 GitHub - anirudhm95/PJ3
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

anirudhm95/PJ3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CSc 220        Assignment 3. (Due April 27, 2014)       Instructor: James Wong
==============================================================================

1. Introduction 

We want to write a program to simulate a bank with multiple tellers. The goal 
of this simulation is to collect statistical information of the bank’s 
customers and tellers. A bank service area consists of several tellers and a 
customer waiting line (or queue). In each time unit, at most one new customer 
arrives at the waiting line. If the customer waiting line is too long, the 
customer leaves without completing transaction; otherwise, the customer gets 
into the waiting line. If all tellers are busy, customers in the waiting lines 
must wait to for a teller. If a teller is free and customers are waiting, the 
first customer in the waiting line advances to the teller’s counter and begins 
transaction.  When a customer is done, the customer departs and the teller 
becomes free. We will run the simulation through many units of time. At the 
end of each time unit, your program should print out a "snap-shot" of queues, 
customers and tellers. At the end of the program, your program should print 
out statistics and conclude simulation.


2. Assumptions and Requirements

2.1. Assumptions

- At most one customer arrives per time unit
- All numbers are positive integer numbers (>=0), except average values 
  should be displayed to two decimal places
- No time lost in between events:
  a customer arriving and entering waiting line
  a customer arriving and leaving without banking
  a customer completing transaction and departing
  a customer leaving the waiting line, advancing to a teller and 
             beginning transaction 

2.2. The limits of simulations parameters

- Maximum number of tellers     10
- Maximum simulation length     10000
- Maximum transaction time      500
- Maximum customer queue limit  50
- Probability of a new customer 1% - 100%


2.3. Input parameters and customer (random/file) data 

- The following data are read at the beginning of the simulation:

  int numTellers;         // number of Tellers.
  int simulationTime;     // time to run simulation
  int customerQLimit;     // customer queue limit
  int chancesOfArrival;   // probability of a new Customer ( 1 - 100)
  int maxTransactionTime; // maximum transaction time per customer
  int dataSource;         // data source: from file or random


- Sample input layout :

  $ java PJ3.BankSimulator

        ***  Get Simulation Parameters  ***

  Enter simulation time (positive integer)       : 10
  Enter maximum transaction time of customers    : 5
  Enter chances (0% < & <= 100%) of new customer : 75
  Enter the number of tellers                    : 3
  Enter customer queue limit                     : 2
  Enter 1/0 to get data from file/Random         : 1        // see details below
  Enter filename                                 : DataFile // for input 1 above

- In each time unit of simulation, your program will need two positive integer 
  numbers to compute (i) boolean anyNewArrival & (ii) int transactionTime. 

  A user should have two options (1 or 0) to specify the source of those numbers:

  For user input 1, numbers are read from a file. A filename should be provided 
  at the beginning of simulation. Each line in a datafile should contain two 
  positive numbers (> 0). A datafile should contain sufficient data for
  simulationTime upto 500 units, i.e. at least 500 lines. In each time unit, 

  anyNewArrival & transactionTime are computed as follows :

         read data1 and data2 from the file;
         anyNewArrival = (((data1%100)+1)<= chancesOfArrival);
         transactionTime = (data2%maxTransactionTime)+1;
 

  For user input 0, numbers are generated by method nextInt() in a Random 
  object, dataRandom, which should be constructed at the beginning of 
  simulation. In each time unit, anyNewArrival & transactionTime are computed as
  follows :

        anyNewArrival = ((dataRandom.nextInt(100)+1) <= chancesOfArrival);
        transactionTime = dataRandom.nextInt(maxTransactionTime)+1;


2.4. Output information

- At the end of each time unit, you program should print out information as 
  example below:

    Time : 7
        customer #6 arrives with transaction time 5 units
        customer #6 wait in the customer queue
        customer #4 is done
        teller  #2 is free
        customer #3 is done
        teller  #3 is free
        customer #6 gets a teller
        teller #2 starts serving customer #6 for 5 units

- At the end of simulation, you need to print out information as the following 
  example :

     End of simulation report


        # total arrival customers  : 6
        # customers gone-away      : 0
        # customers served         : 6

        *** Current Tellers Info. ***


        # waiting customers : 0
        # busy tellers      : 1
        # free tellers      : 2

        Total waiting time         : 0
        Average waiting time       : 0.00


        Busy Tellers Info. :


                Teller ID                : 2
                Total free time          : 2
                Total busy time          : 8
                Total # of customers     : 3
                Average transaction time : 2.67


        Free Tellers Info. :


                Teller ID                : 3
                Total free time          : 5
                Total busy time          : 5
                Total # of customers     : 1
                Average transaction time : 5.00


                Teller ID                : 1
                Total free time          : 2
                Total busy time          : 8
                Total # of customers     : 2
                Average transaction time : 4.00


2.5 Data structures and simulation algorithm

- I have defined package PJ3 with the Customer, Teller and ServiceArea classes. 
  You need to implement their methods. I also provide an outline of a 
  simulation program BankSimulator.java. 


3. Compile and run program

- You need to download PJ3 zip file (with sample datafie) from ilearn.

- Compile programs (you are in directory containing Readme file):

  javac PJ3/*.java

- Run programs (you are in directory containing Readme file):

  // Run simulation
  java PJ3.BankSimulator

- Bonus (50%): Implement GUI test program

  Talk to me before you start this bonus program.

4. Due Date 

- 11:55 of Sunday, April 27, 2014 
- To submit your project, you need to zip all source files (*.java) and
  upload it to ilearn.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%
0