Solution to 'Bank Teller Service Problem' on Linux x86_64.
- GNU Make
- C++ compiler supporting C++11
To run the program, run:
$ make run <env>
The <env>
can be:
CXX
: Specify the C++ compiler. Defaults tog++
CXXFLAGS
: Compiler options. Using the default value is recommendedNTELLER
: The number of bank tellers. Defaults to 3NCUSTOMER
: The number of customers. Defaults to 10MINSERVTIME
: The minimum value of the time that customers will be served for. Defaults to 1MAXSERVTIME
: The maximum value of the time that customers will be served for. Defaults to 10MINENTERTIME
: The minimum value of the time when customers will enter the bank. Defaults to 1MAXENTERTIME
: The maximum value of the time when customers will enter the bank. Defaults to 10
For an example:
$ make run NTELLER=10 NCUSTOMER=20 MAXSERVTIME=5 MAXENTERTIME=40
To just build the program, please run:
$ make
or
$ make build
Then the program will be built in src/target
.
To generate a test case, please run:
$ make test <env>
The <env>
can be NCUSTOMER
, MINSERVTIME
, MAXSERVTIME
, MINENTERTIME
or MAXENTERTIME
. Just as introduced above.
To generate a new test case, run:
$ make retest <env>
To run the test case generated by make test
or make retest
, please run:
$ make run NTELLER=<value>
If no test cases are generated before, it will generate a new test case, just as 'Quick Start' shows.
Run:
$ make debug NTELLER=<value>
or run NTELLER=<value> src/target/main
after building the program.
Then the program will wait for your keyboard input. The input format is:
- Multilines
- Each line contains three non-negative integers, split by spaces or tabs, representing one customer. The first integer is the customer's ID. The second integer is the time when the customer will enter the bank. The third integer is the time that the customer will be served for.
For example:
1 1 10
2 5 2
3 6 3
To delete all files generated when building, run:
$ make clean