Miladsob
پنج شنبه 12 آبان 1390, 02:13 صبح
من این برنامه پائین رو نوشتم ولی نمی دونم که چجوری با درست بودن شرط IF به اول حلقه برگردم!
در برنامه پايین میخوام وقتی این شرط if (ArrCount<Namadha){ درست دراومد به اول حلقه برگرده
double nextArr = RandExpon.nextDouble();
double nextDep = RandExpon.nextDouble();
while (nextArr < nextDep){
ArrCount++;
if(ServerState=false){//is Server Off??
ServerState=true;//if Server is Off then Turn On it
nextArr = nextArr + RandExpon.nextDouble();
}
else{
if(QueueLen<0){// is Queue empty or not?
QueueLen++;//add Item to Queue
nextArr = nextArr + RandExpon.nextDouble();
}
else{
lossCount++;//Item Lost
nextArr = nextArr + RandExpon.nextDouble();
}
}
if (ArrCount<Namadha){
//if this condition is true go to first of while //
}
else{
PLoss.setText(String.valueOf( lossCount/ArrCount));
}
}
}
در برنامه پايین میخوام وقتی این شرط if (ArrCount<Namadha){ درست دراومد به اول حلقه برگرده
double nextArr = RandExpon.nextDouble();
double nextDep = RandExpon.nextDouble();
while (nextArr < nextDep){
ArrCount++;
if(ServerState=false){//is Server Off??
ServerState=true;//if Server is Off then Turn On it
nextArr = nextArr + RandExpon.nextDouble();
}
else{
if(QueueLen<0){// is Queue empty or not?
QueueLen++;//add Item to Queue
nextArr = nextArr + RandExpon.nextDouble();
}
else{
lossCount++;//Item Lost
nextArr = nextArr + RandExpon.nextDouble();
}
}
if (ArrCount<Namadha){
//if this condition is true go to first of while //
}
else{
PLoss.setText(String.valueOf( lossCount/ArrCount));
}
}
}