You are on page 1of 7

Hacettepe University Department Of Computer Engineering Bil235 Programming Laboratory

Subject : Submission Date : Due Date : Programming Environment: Advisors : Data Structures 7.7.2012 20.7.2012 C++ / MinGW - Windows Vista/7 R.A. Tuba Grgen - Ahmet Selman BOZKIR

EXPERIMENT All operations in banking are called transactions. Every deposit operation and etc. named as transaction. In this experiment you have one transaction list file belong to a bank queue system. You will find the columns names of that table in the list written below: trans.txt The transaction list file is a plain text file. The format of the file is: <coming minute> <name of customer> <length of operation (in minutes)> <transaction amount>

Arrival Minute: The minute when the customer enqueued in bank. Length of Op Time to finish the customers operation (in minutes). Trans. Amount: The amount of the money that customer draw or deposit.

In our example bank queue simulation, there are variable numbers of pay-offices (user must enter it at the startup of program) which has an initial balance (500 TL in our program) and several customers each have a unique name and the information about coming minute, length of operation and transaction amount. Whenever a customer has arrived bank he/she must be added to queue. Each customer can use pay-offices only once. Program must try to process every customer when he/she arrived to pay office. But of course, due to some reasons this may not be achieved. Here is a couple of reasons for this:

1. All the pay-offices may be full at that minute. (The minute when customer arrived) 2. Customer may want to draw an amount of money that is not available in any of payoffice. (He/she must be placed one after that queue. In other words he/she must give his/her position to the next customer.)
Pay Office 1 Pay Office 2 Pay Office 3 Coming minute 1 1 2 3 4 5 5 murat vedat 7 n Name selman tulin murat vedat seda salih ayse emre . Op. Time 1 2 3 3 2 3 2 4 . Amount 150 -300 200 400 -250 -900 400 100 .

selman

tulin

seda

N customers (in trans.txt file)


ayse

salih (waited until 7.th minute. Although other pay-offices were free but only 1.st pay-office had enough money.)

(Sample scenario: here we have 3 pay offices) In the schema above, the workflow of program is explained shortly. Every customer is being sent to closest available (availability of both time and pay-offices balance) pay office. If first pay office is full then try to second, third and so on considering the pay offices balance. This is important if customer draws money. Even there is an available pay office at arrival moment however there is no available pay office for sufficient balance, that customer must placed one after the queue (shift) and this event must be printed on screen. In this program youre expected to form the structure explained above by using structs, queue logic and linked lists. Program must provide two running options to user: 1. Run until the last customers operation had done.(Finish all customers) 2. Run until a minute value that user has entered. If first choice is selected system will try to process all customers requests in a suitable way. However, if the second choice selected, system will be run until the specified minute and on that minute, processing is stopped. Note that static queues are prohibited. Both the number of pay offices and the customers must be dynamically formed. Disk access must be minimally. Every operation must be done at memory. In the given and test input files (evaluation test files) every customer will be processed. Hence, there will be no balance problem. The input cases are formed considering this issue !!!

Sample Screenshots:

Startup screen of the example program. 1.List all customers: Print the queue list in time order as shown below. Listing function must use memory (Read them from disk file only once at startup of program!)

Menus first options result screen

2.Search for a customer in the queue: Searches the queue to find a person that has name match. The name must be given by user on screen as shown below.

Menus second options result screen 3. Process all customers: In this option youre expected to process all customers and then dump all the operations on the screen. Program must try to put the next customer in an available pay office when his/her arrival moment has come but if theres no free one, then advance next minute and try again to put the persons whose times has come. Whenever a customer has processed, a pay-office report must be printed on the screen. In this simple report pay offices balance and count of completed services must be explained. An example output of program is given in the list below: After all, you must print a summary sentence on the screen as in the format below. [Finish minute of queue: #1 | Number of serviced customer : #2 | Number of shifted person: #3] #1 : finish minute (natural finishing minute (for running mode 1)) #2 : total number of customers who has been processed. #3 : total number of customers who are shifted because of insufficient balance etc...

1. dakikada selman atamasi 0 nolu vezneye yapildi. 150 TL yatirdi. VEZNE RAPORU Vezne 0 [Bakiyesi:650 Yaptigi Islem:1] Vezne 1 [Bakiyesi:500 Yaptigi Islem:0] Vezne 2 [Bakiyesi:500 Yaptigi Islem:0] 1. dakikada tulin atamasi 1 nolu vezneye yapildi. 300 TL cekti. VEZNE RAPORU Vezne 0 [Bakiyesi:650 Yaptigi Islem:1] Vezne 1 [Bakiyesi:200 Yaptigi Islem:1] Vezne 2 [Bakiyesi:500 Yaptigi Islem:0] 2. dakikada murat atamasi 0 nolu vezneye yapildi. 200 TL yatirdi. VEZNE RAPORU Vezne 0 [Bakiyesi:850 Yaptigi Islem:2] Vezne 1 [Bakiyesi:200 Yaptigi Islem:1] Vezne 2 [Bakiyesi:500 Yaptigi Islem:0] 3. dakikada vedat atamasi 1 nolu vezneye yapildi. 400 TL yatirdi. VEZNE RAPORU Vezne 0 [Bakiyesi:850 Yaptigi Islem:2] Vezne 1 [Bakiyesi:600 Yaptigi Islem:2] Vezne 2 [Bakiyesi:500 Yaptigi Islem:0] 4. dakikada seda atamasi 2 nolu vezneye yapildi. 250 TL cekti. VEZNE RAPORU Vezne 0 [Bakiyesi:850 Yaptigi Islem:2] Vezne 1 [Bakiyesi:600 Yaptigi Islem:2] Vezne 2 [Bakiyesi:250 Yaptigi Islem:1] (!!!5. dakikada salih sirasi degistirildi.!!!) 5. dakikada ayse atamasi 0 nolu vezneye yapildi. 400 TL yatirdi. VEZNE RAPORU Vezne 0 [Bakiyesi:1250 Yaptigi Islem:3] Vezne 1 [Bakiyesi:600 Yaptigi Islem:2] Vezne 2 [Bakiyesi:250 Yaptigi Islem:1] 7. dakikada salih atamasi 0 nolu vezneye yapildi. 950 TL cekti. VEZNE RAPORU Vezne 0 [Bakiyesi:300 Yaptigi Islem:4] Vezne 1 [Bakiyesi:600 Yaptigi Islem:2] Vezne 2 [Bakiyesi:250 Yaptigi Islem:1] 7. dakikada emre atamasi 1 nolu vezneye yapildi. 100 TL yatirdi. VEZNE RAPORU Vezne 0 [Bakiyesi:300 Yaptigi Islem:4] Vezne 1 [Bakiyesi:700 Yaptigi Islem:3] Vezne 2 [Bakiyesi:250 Yaptigi Islem:1]

.. .. ..
[Kuyruk biti zaman: 24 | Hizmet alan musteri sayisi: 23 | Sirasi degisenler: 1]

4.Process customers until a minute: In this option youre expected ask user the operation stop minute and system will take customers until that minute. After that moment bank is closed and system must print all the operations on screen as in the sample screenshot below. Just like in 3. menu option after all you must print a summary sentence to screen as in the format below. [End minute of queue: #1 | Number of serviced customer : #2 | Number of shifted person: #3] #1 : end minute (user selected termination minute value) #2 : total number of customers who has been processed. #3 : total number of customers who are shifted because of insufficient balance.

A sample screenshot from 4.menu 5.Show pay offices logs: Print the pay officess process logs as shown below. If a created pay office did not have processed and customer you can ignore it in the list. The output must be printed both screen and file (output.txt).

Pay offices logs. (Here we have 3 pay offices for 23 customers)

6. Show most running pay-office: Find most running pay-office during the day and print it on the screen. The criterion for this is the transaction count of pay-office.

NOTES: SAVE all your work until the experiment is graded. The assignment must be original, INDIVIDUAL work. Downloaded or modified source codes will be considered as cheating. Also the students who share their works will be punished in the same way. You cannot use any global variables. Benefiting of the C++ language features is prohibited. Write your code in ANSI C language. You cannot use any predefined C/C++ data structure library in your project. You cannot use goto statement in your program. Put structure definitions and function prototypes in the header file and dont forget to write comments of your codes when necessary. You can ask your question via courses news group. news://news.cs.hacettepe.edu.tr/dersler.bil235 SUBMISSONS: The experiment code will be tested in MinGW Developer Studio 2.05. Please ensure that your code is well working. If your program crashes at the startup it will be graded with 0. Your submission will be in the format below <Bil235_StudentID> |-- report -- report.pdf |-- source -- bank.cpp -- bank.mdsp (MinGW Project File) -- trans.txt You have to use Online Experiment Submission System. http://submit.cs.hacettepe.edu.tr Other type of submissions especially by e-mail WILL NOT BE ACCEPTED. Submission deadline is 20.7.2012, 17.05 pm. Do not forget to sign the "submission paper" after you submit your experiment.

You might also like