Programming Language

The program is required to be developed in JAVA.

Problem Description

As a software engineer, you are requested by the State Bank of Victoria to write a program to simulate its customer service, and consequently to obtain information such as customers average waiting time and tellers idle time in one of its branches.

During business hours, a customer can come into the bank and request services from a teller at the counter. If a customer cannot access a teller immediately because all tellers are busy serving other customers, then the customer will wait. All waiting customers form a queue based on the time they arrived. The one who arrived earliest stands at the front of the queue. The one who came in last stands at the end of the queue. Customers in the queue move forward when a teller becomes available and the front customer is called to be served. After being served, the customer leaves the bank.

Definition of Terms

A number of terms which are utilised in the program will be defined as below.


A customer is a person who comes to the bank, and brings a number of tasks for the teller to complete. In the program, a customer is described by following attributes

id int a unique positive integer to identify the customer.
arriveTime Date the time the customer arrives at the bank.
waitTime int the time the customer waited in the queue.
teller String name of the teller who serviced the customer.
tasks Task[] an array of tasks being brought by the customer.

There are two types of special customers: elderly and underAge. Service time for an elderly can be longer than normal customers. Each elderly has their own extra service time (est).

est int extra service time (in minutes) for the customer

An underAge customer can only be served with certain types of tasks. This means that tasks being brought in by an underAge may not be processed by the teller. If a task is not processed, then it should be not counted for the service time.


A task is a service work the customer brings to the bank and requests the teller to complete for them. A customer may bring a sequence of tasks each time they enter the bank. A task will be one of following types:

(1) opening an account
(2) transferring a fund
(3) general inquiry

Each task can be described by the following data attributes

type char type of the task. (‘o’, ‘t’ and i’ can be used to represent the three types)
processTime int the time (in minutes) normally required to process the task.

For an underAge customer, only (1) and (3) types can be processed. If an underAge brings in a transferring a fund task, the teller will not process it.


A teller is a person who works at the counter to serve customers (ie. to complete tasks brought in by customers). Tellers are divided into two levels: junior and senior.

When two or more tellers are available and there is only one customer waiting, then the teller who became available at the earliest time, takes the customer. For example, if amy (junior), leanne (junior) and chris (senior) are 3 tellers who become available at 10:42am, 10:55am and 10:59am respectively, and a customer arrives at 11:01am, amy takes the customer. If a second customer comes in at 11:03am, leanne takes the customer. It is always the senior teller who takes the customer when multiple tellers (junior and senior) are available at exactly the same time. For example if amy, leanne and chris all become available at 10:42am, and there is only one customer waiting, chris takes the customer.

Although each task has a processTime, the actual time a teller spends to complete the task is calculated as follows

𝑎𝑐𝑡𝑢𝑎𝑙𝑃𝑟𝑜𝑐𝑒𝑠𝑠𝑖𝑛𝑔𝑇𝑖𝑚𝑒 = {
𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑖𝑛𝑔𝑇𝑖𝑚𝑒 ×1.2, 𝑓𝑜𝑟 𝑎 𝑗𝑢𝑛𝑖𝑜𝑟
𝑡𝑒𝑙𝑙𝑒𝑟 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑖𝑛𝑔𝑇𝑖𝑚𝑒 ×0.9, 𝑓𝑜𝑟 𝑎 𝑠𝑒𝑛𝑖𝑜𝑟 𝑡𝑒𝑙𝑙𝑒𝑟

est for elderly should remind the same regardless the level of the teller. A teller is described by following data attributes.

name String name of the teller.
level char level of the teller (‘j” for junior and ‘s’ for senior)
idleTime int accumulated time for a teller to wait for a customer to arrive.

A tellers name is always just one word and is unique.


The text file (input.txt) contains all required data to run the simulation. The file specifies

(1) name of the branch
(2) a list of tellers (name and level) who work at the counter. At the start of the simulation, all tellers are available at the counter to serve customers.
(3) a sequence of customers (id, underAge/elderly/normal, enterTime and an array of tasks). Note that enterTime is the time interval (in minutes) between the start of the simulation and the time the customer arrives at the bank. Each task is described by its type and processTime. est is appended at the end of the record for an elderly.

Sample of input.txt is shown in Figure 1 as below See image.

Your Program and Its Execution

In this assignment you are required to write the program to simulate the customer serving environment.

Handling exceptions

Except for those checked exceptions that you must handle in your program, there is one type of exception that you need to define and handle. The exception is transferFundByUnderAge exception. It should be defined by extending from the Exception class. If the teller is encountered a transferring a fund task and the customer is an underAge, then a transferFundByUnderAge object will be created and thrown. A message will be displayed to inform this on the monitor and also in the output file. The task will not be processed.

Inserting the timestamp

At the beginning of the simulation, a timestamp (including the year, month, day and time) should be displayed in the output file. The time will be utilised as the base for calculating customers arriving time and the time when the simulation is ended.

The timestamp which includes the current date and time can be established by

(1) obtaining the current time (in milliseconds) from the System class
(2) converting it into the (year, month, day, hour, minute and second) format using the Date class. Note: there are two Date classes in JAVA API. Use the one defined in the java.util package.

The actualProcessingTime for a task

A task has a processTime which is an integer. A task can be processed by a junior or senior teller, and hence the actualProcessingTime can vary for the same task. If after calculation, the actualProcessingTime becomes a decimal number, it should be rounded into an integer.

For instance, if the processTime for a task is 4 minutes and if the task is processed by a junior teller, then

actualProcessingTime = processTime × 1.2
= 4 × 1.2
= 4.8 minutes

The actualProcessingTime will be rounded to 5 minutes.

Program Execution

Your program should operate as follows.

The program is called with two command line arguments, for example:

java BankSimulation input.txt output.txt

The two argument are (1) name of input file name and (2) name of output file. If either file cannot be opened your program must print an appropriate message to the monitor and then exit.

All input to this program is from input.txt. There is no user input in this program. In particular the program will not ask the user to enter the name of any files. File names are entered as command line arguments only.

While information on exception handling can be displayed on the monitor, all other output goes to the output file.


The output file output.txt contains outcomes of the simulation. These include the name of the branch, the starting and ending times of the simulation.

During simulation, it outputs the status of each teller and customer every minute. For a teller, it displays if the teller is idle or serving a customer. For a customer, it displays if they are waiting in the queue or is being served.

In addition, it indicates underAge transferring fund skipped whenever it happens. It also outputs the number of customers waiting in the queue.

Finally, it outputs

(1) the average customers’ waiting time and
(2) tellers’ total idle time and
(3) it answers the question: Has the goal “at least 95% of customers waited less than 10 minutes” been achieved?

The next page shows a sample of the text file.

Customer Service Simulation

Branch: Flinders Street Branch
Starting Time: 2015-09-02 10:40

Tellers: amy (junior), leanne (junior) and chris (senior)

10:40 amy idle
leanne idle
chris idle

Queue (number of waiting 0)


amy idle
leanne idle
chris customer 1/task o/

Queue (number of waiting 0)


amy customer 2/task i/ (underAge transferring fund skipped)
leanne idle
chris customer 1/task o/

Queue (number of waiting 0)


customer 2/task i/
Leanne customer 3/task o/
chris customer 1/task o/

Queue (number of waiting 0)


customer 2/task i/
Leanne customer 3/task o/
chris customer 1/task o/

Queue (number of waiting 1)/customer 4/


amy customer 2/task i/
Leanne customer 3/task o/
chris customer 1/task o/

Queue (number of waiting 2) customer 4/customer 5/


amy customer 2/task i/
Leanne customer 3/task o/
chris customer 1/task o/

Queue (number of waiting 2) customer 4/customer 5/

// Some lines removed for brevity


amy customer 24/task o/
leanne idle
chris idle

Queue (number of waiting 0)


amy idle
leanne idle
chris idle

Queue (number of waiting 0)


Ending Time: 2015-09-02 11:32

Customers’ average waiting time: 3.34 minutes
Tellers’ total idle time 49 minutes 4.2% of customers waited more than 10 minutes in the queue. Consequently the goal “at least 95% of customers waited less than 10 minutes” has been achieved.

Coding Style

Your code should be neat, correctly indented and documented.

For each class, you are required to indicate the purpose and hierarchy of the class. You need to have comments for each method to indicate the purpose, parameters and return data. Appropriate comments in the program body are required as well.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.