#include
#include
#include
int ia(int a)
{
if(a>=0 && a<=25)
return 1;
if(a>=26 && a<=50)
return 2;
if(a>=51 && a<=75)
return 3;
if(a>=76 && a<=99)
return 4;
return 0;
}
int sa(int a)
{
if(a>=0 && a<=25)
return 1;
if(a>=26 && a<=50)
return 2;
if(a>=51 && a<=75)
return 3;
if(a>=76 && a<=99)
return 4;
return 0;
}
void main()
{
int a[5],notice[2][2],b[5],e[5],d[5]={0,0,0,0,0},f[5],i,c[5],s1[5];
clrscr();
for(i=0;i<5;i++)
{
a[i]=rand()%100;
s1[i]=rand()%100;
}
for(i=0;i<5;i++)
{
if(i==0)
{
b[i]=ia(a[i]);
f[i]=b[i];
}
else
{
b[i]=b[i-1]+ia(a[i]);
if(d[i-1]>b[i])
f[i]=d[i-1];
else
f[i]=b[i];
}
c[i]=sa(s1[i]);
e[i]=65+i;
d[i]=f[i]+c[i];
notice[1][0]=b[i];
notice[1][1]=e[i];
if(i>0 && notice[1][0]0 && notice[1][0]>notice[0][0])
printf( " (%d,%c)(%d,%c)\n",notice[0][0],notice[0][1],notice[1][0],notice[1][1]);
if(i==0)
printf("InterArr Arrival EventNtc ServTime ServComp Notice\n");
printf("%6d%9d (%c,%4d)%8d%8d",ia(a[i]),b[i],e[i],f[i],c[i],d[i]);
notice[0][0]=d[i];
notice[0][1]=e[i];
}
printf(" (%d,%c)",notice[0][0],notice[0][1]);
getch();
}
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