FEL by Saurabh Piyush
MCA/4509/10
*/ FEL GENERATED FOR 500 CUSTOMERS------TIME =1000 mins */
#include
#include
#include
typedef struct
{
int cust_no,int_arrival,arrival,service,tsb,tse,wait,tsis,idle;
}customer;
int lookup2(int c)
{
if(c>=0 && c<11)
{
return 1;
}
else if(c>=11 && c<31)
{
return 2;
}
else if(c>=31 && c<61)
{
return 3;
}
else if(c>=61 && c<86)
{
return 4;
}
else if(c>=86 && c<96)
{
return 5;
}
return 6;
}
int lookup1(int c)
{
if(c>=0 && c<13)
{
return 1;
}
else if(c>=13 && c<25)
{
return 2;
}
else if(c>=25 && c<38)
{
return 3;
}
else if(c>=38 && c<50)
{
return 4;
}
else if(c>=50 && c<63)
{
return 5;
}
else if(c>=63 && c<75)
{
return 6;
}
else if(c>=75 && c<87)
{
return 7;
}
return 8;
}
void printlist(customer c)
{
printf("\n");
printf("%d\t",c.cust_no);
printf("%d\t",c.int_arrival);
printf("%d\t",c.arrival);
printf("%d\t",c.service);
printf("%d\t",c.tsb);
printf("%d\t",c.tse);
printf("%d\t",c.tsis);
printf("%d\t",c.wait);
printf("%d\t",c.idle);
}
customer initialize(customer c)
{
c.cust_no=1;
c.int_arrival=0;
c.arrival=0;
c.service=lookup2(rand()%100);
c.tsb=0;
c.tse=c.service;
c.wait=0;
c.idle=0;
c.tsis=c.service;
printlist(c);
return c;
}
typedef struct
{
char ename;
int time;
}event;
int max(int a,int b)
{
return a>=b?a:b;
}
void sort_fel(event fel[],int t,int in,int dp)
{
event temp[3],temp2;
int i,j;
for(i=0;i<3;i++)
{
temp[i]=fel[i];
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if(temp[i].time
1. There is only one telephone in a public booth of a metro station. Following table indicates the distribution of arrival time and duration of calls: Time Between arrivals (minutes) 4 5 6 Probability 0.1 .6 0.3 Call Duration (minutes) 3 4 5 6 Probability 0.14 0.6 0.12 0.14 Simulate for 100/500/1000 times. Conduct 3 such trials. It is proposed to add another telephone to the booth. Justify the proposal based on the waiting time of caller.Generate graphs to support your answer. 2. A baker needs to find out the cookies he need to bake each day. The probability distribution for the cookies customers is as follows: Number of customers/day 7 9 11 14 Probability 0.35 0.30 0.15 0.20 C...
Comments