Professional Documents
Culture Documents
The Evelator
The Evelator
COMPUTATION
3- The temporary memory receives these requests and sends them to the processor to calculate the
required time and distance to reach each floor if we assume that the current position of the
elevator is the first floor, then this preliminary data appears in the output.
5- Based on the user's entry for the current floor, operations are arranged according to the floors
closest to the current floor, and the furthest floors are arranged sequentially according to ascent
6- The time and distance traveled by the elevator are calculated to complete this process.
}
Console.WriteLine("=================================");
await Task.Delay(1000);
Console.WriteLine("Prossing in CPU...");
await Task.Delay(2000);
int totalDistance = 0;
int totalTime = 0;
for (int i = 0; i < floorsize; i++)
{
int distance = Math.Abs(currentFloor - FloorsNum[i]) * 3;
int time = distance / 3 * 3;
totalDistance += distance;
totalTime += time;
currentFloor = FloorsNum[i];
}
}
Console.WriteLine("The elevator will travel " + totalDistance + " meters and it will take " + totalTime + " seconds to reach all the
floors.");
-------------------------------
2
Student: Esmaail mo. Almawri –CS3
These are its outputs:
3
Student: Esmaail mo. Almawri –CS3