there is a large busy cosmetic store. In store, for billing, there are four counters with four tellers (who deal payment etc) . A customer comes to the store and collects the things he/she wants to purchase and go to one of the counters to pay for purchase. If there are already people in front of counters, customer has to stand in the queue. A customer generally selects the shortest queue (with respect to the number of people in queue). The selection can become wrong if one of the people in the queue has a huge buying list. But if we know the estimated time of each customer in the queue, selection can become efficient. The system can become efficient, if we tell a new person which one is the shortest queue with respect to time taken by the people waiting in the queue.#include <iostream>
#include <conio.h>
#include <cstdlib>
#include "Customer.h"
#include "Teller.h"
using namespace std;
int main(){
tellr T1, T2, T3, T4;
int a,b,c,d;
char m;
while(m != 'n'){
int tym;
cout << "Enter duration of your transaction: ";
cin >> tym;
a= T1.TotalTym(),b = T2.TotalTym(),c = T3.TotalTym(),d = T4.TotalTym();
int minimum = a;
if(b < minimum)minimum = b; if(c < minimum)minimum = c; if(d < minimum)minimum = d;
if(a == minimum) {
cout << "Enter in 1" << endl;
T1.addthecustomer(tym);
}
else if(b == minimum) {
cout << "Enter in 2" << endl;
T2.addthecustomer(tym);
}
else if(c == minimum){
cout << "Enter in 3" << endl;
T3.addthecustomer(tym);
}
else if(d == minimum) {
cout << "Enter in 4" << endl;
T4.addthecustomer(tym);
}
cout << "Do you want to Buy Another Ticket(Y/N) ";
cin >> m;
}
int minimum_custmer;
int w = T1.t_customer(), x = T2.t_customer(), y = T3.t_customer(), z = T4.t_customer();
minimum_custmer=w;
if (x > minimum_custmer)minimum_custmer=x; if (y > minimum_custmer)minimum_custmer=y; if (z > minimum_custmer)minimum_custmer=z;
cout << "\nNumber of Customers Deal By Every tellr " << endl;
cout << "T1 " << T1.t_customer() << "\n";
cout << "T2 " << T2.t_customer() << "\n";
cout << "T3 " << T3.t_customer() << "\n";
cout << "T4 " << T4.t_customer() << "\n";
if ( w == minimum_custmer) {
cout<< "Maximum number of customers dealt by teller 1\n";
}
if ( x == minimum_custmer) {
cout<< "Maximum number of customers dealt by teller 2\n";
}
if ( y == minimum_custmer) {
cout<< "Maximum number of customers dealt by teller 3\n";
}
if ( z == minimum_custmer) {
cout<< "Maximum number of customers dealt by teller 4\n";
}
getch();
}