text
stringlengths 0
234
|
|---|
randNum: float;
|
begin
|
randNum := next_float(x); -- 0.0 <= randNumm <= 1.0.
|
if randNum <= 0.25 then
|
return 1; -- return tie
|
elsif randNum <= 0.5 then
|
return 2; -- return tie
|
elsif
|
randNum <= 0.75 then
|
return 3; -- return tie
|
else
|
return 4; -- return stsr
|
end if;
|
end NumberNewArrivals;
|
Start,Finish, elapsed, secondus : DAY_DURATION;
|
StartTime, ArrivTime, departTime, ElapsTime : Time := clock;
|
-- Procedure to get start time
|
--function startTime return DAY_DURATION is
|
-- Year,Month,Day : INTEGER;
|
--Start : DAY_DURATION;
|
--Time_And_Date : TIME;
|
--begin
|
--Time_And_Date := Clock; -- gets system time
|
--Split(Time_And_Date,Year, Month,Day,Start);
|
--return Start; -- gets start time ( stores it in seconds in the variable Start)
|
--end startTime;
|
-- Procedure to get finish time
|
function finishTime return DAY_DURATION is
|
Year,Month,Day : INTEGER;
|
Finish : DAY_DURATION;
|
Time_And_Date : TIME;
|
begin
|
Time_And_Date := Clock; -- gets system time
|
Split(Time_And_Date,Year, Month,Day,Finish);
|
return Finish; -- gets start time ( stores it in seconds in the variable Start)
|
end finishTime;
|
numberArrivals,seed,upperbound,starKnt,tieKnt, dagobah, repairStar, repairTie: Integer := 0;
|
decision: garageBay;
|
ET: DAY_DURATION;
|
begin
|
-- Get upperbound of the stack.
|
put("Enter The Maximum Number Of Vehicles Allowed In The Garagebay:"); new_line;
|
get(upperbound);
|
declare
|
-- Instantiate the generic package for type garageBay.
|
package genericS is new gstack(upperbound, garageBay);
|
use genericS;
|
begin
|
-- Lab Step 0. write start time to service log.
|
--start := startTime;
|
--finish := finishTime;
|
--elapsed := finish - start;
|
--ET := elapsed;
|
startTime := clock;
|
put(Image(startTime, Time_Zone => -5*60) ); put(" Garagebay is open ");
|
new_line;
|
-- Seed the random number generator appropriately.
|
put("Seed the random number generator:"); new_line;
|
get(seed);
|
put("-----------------------------------------------------------------------------------");new_line;
|
-- do the operations
|
--numberArrivals := 3; -- Assuming 3 vehicles at open.
|
Loop
|
numberArrivals := NumberNewArrivals(seed);
|
put("Number of Arrivals: ");new_line;put(numberArrivals,0);new_line;
|
put("-----------------------------------------------------------------------------------");new_line;
|
for j in 1..numberArrivals
|
loop
|
--Determine if the arrival is a Tie Fighter or a Star Destroyer.
|
--Prepare the maintenance record and place it in the appropriate queue.
|
decision := StarOrTie(seed);
|
if decision.vehicleType = Star_Destroyer
|
then
|
intStar := intStar + 1;
|
if intStar = 91 then
|
intStar := 65;
|
end if;
|
charStar := intToChar(intStar);
|
decision.vehicleName(1..4) := "Star";
|
decision.vehicleName(5) := charStar;
|
decision.time2Fix := 7;
|
ArrivTime := clock;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.