Lab 05

Process Queue Simulator

 

Objective:

 

Write a program which simulates first come first serve process scheduling using a queue.

 

Lab Solution

 

Requirements:

 

Process Name: <<Name>> Completion Time: <<Completion Time>>

 

 

Example Dialog:

 

---------------------------

Welcome to the

process scheduler

simulator

---------------------------

 

 

---------------------------

Time Step 0

---------------------------

***No processes currently running***

***Current Process Queue***

---------------------------

Time Step 1

---------------------------

***Adding a new Process Process Name: Process1 Completion Time: 6.193690462232073***

***Current Process Process Name: Process1 Completion Time: 6.193690462232073***

***Updating Completion Time Process Name: Process1 Completion Time: 5.193690462232073***

***Current Process Queue***

---------------------------

Time Step 2

---------------------------

***Current Process Process Name: Process1 Completion Time: 5.193690462232073***

***Updating Completion Time Process Name: Process1 Completion Time: 4.193690462232073***

***Current Process Queue***

---------------------------

Time Step 3

---------------------------

***Adding a new Process Process Name: Process2 Completion Time: 5.351469525086384***

***Current Process Process Name: Process1 Completion Time: 4.193690462232073***

***Updating Completion Time Process Name: Process1 Completion Time: 3.193690462232073***

***Current Process Queue***

Process Name: Process2 Completion Time: 5.351469525086384

---------------------------

Time Step 4

---------------------------

***Adding a new Process Process Name: Process3 Completion Time: 13.384343172978909***

***Current Process Process Name: Process1 Completion Time: 3.193690462232073***

***Updating Completion Time Process Name: Process1 Completion Time: 2.193690462232073***

***Current Process Queue***

Process Name: Process2 Completion Time: 5.351469525086384

Process Name: Process3 Completion Time: 13.384343172978909

---------------------------

Time Step 5

---------------------------

***Current Process Process Name: Process1 Completion Time: 2.193690462232073***

***Updating Completion Time Process Name: Process1 Completion Time: 1.1936904622320732***

***Current Process Queue***

Process Name: Process2 Completion Time: 5.351469525086384

Process Name: Process3 Completion Time: 13.384343172978909

---------------------------

Time Step 6

---------------------------

***Current Process Process Name: Process1 Completion Time: 1.1936904622320732***

***Updating Completion Time Process Name: Process1 Completion Time: 0.1936904622320732***

***Current Process Queue***

Process Name: Process2 Completion Time: 5.351469525086384

Process Name: Process3 Completion Time: 13.384343172978909

---------------------------

Time Step 7

---------------------------

***Current Process Process Name: Process1 Completion Time: 0.1936904622320732***

***Updating Completion Time Process Name: Process1 Completion Time: 0.0***

***Current Process Queue***

Process Name: Process2 Completion Time: 5.351469525086384

Process Name: Process3 Completion Time: 13.384343172978909

---------------------------

Time Step 8

---------------------------

***Adding a new Process Process Name: Process4 Completion Time: 1.7423775117100637***

***Current Process Complete***

***New current process Process Name: Process2 Completion Time: 5.351469525086384***

***Current Process Queue***

Process Name: Process3 Completion Time: 13.384343172978909

Process Name: Process4 Completion Time: 1.7423775117100637

---------------------------

Time Step 9

---------------------------

***Current Process Process Name: Process2 Completion Time: 5.351469525086384***

***Updating Completion Time Process Name: Process2 Completion Time: 4.351469525086384***

***Current Process Queue***

Process Name: Process3 Completion Time: 13.384343172978909

Process Name: Process4 Completion Time: 1.7423775117100637

---------------------------

Time Step 10

---------------------------

***Current Process Process Name: Process2 Completion Time: 4.351469525086384***

***Updating Completion Time Process Name: Process2 Completion Time: 3.351469525086384***

***Current Process Queue***

Process Name: Process3 Completion Time: 13.384343172978909

Process Name: Process4 Completion Time: 1.7423775117100637

---------------------------

Time Step 11

---------------------------

***Current Process Process Name: Process2 Completion Time: 3.351469525086384***

***Updating Completion Time Process Name: Process2 Completion Time: 2.351469525086384***

***Current Process Queue***

Process Name: Process3 Completion Time: 13.384343172978909

Process Name: Process4 Completion Time: 1.7423775117100637

---------------------------

Time Step 12

---------------------------

***Current Process Process Name: Process2 Completion Time: 2.351469525086384***

***Updating Completion Time Process Name: Process2 Completion Time: 1.351469525086384***

***Current Process Queue***

Process Name: Process3 Completion Time: 13.384343172978909

Process Name: Process4 Completion Time: 1.7423775117100637

---------------------------

Time Step 13

---------------------------

***Current Process Process Name: Process2 Completion Time: 1.351469525086384***

***Updating Completion Time Process Name: Process2 Completion Time: 0.35146952508638396***

***Current Process Queue***

Process Name: Process3 Completion Time: 13.384343172978909

Process Name: Process4 Completion Time: 1.7423775117100637

---------------------------

Time Step 14

---------------------------

***Adding a new Process Process Name: Process5 Completion Time: 10.03799757890731***

***Current Process Process Name: Process2 Completion Time: 0.35146952508638396***

***Updating Completion Time Process Name: Process2 Completion Time: 0.0***

***Current Process Queue***

Process Name: Process3 Completion Time: 13.384343172978909

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

---------------------------

Time Step 15

---------------------------

***Current Process Complete***

***New current process Process Name: Process3 Completion Time: 13.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

---------------------------

Time Step 16

---------------------------

***Current Process Process Name: Process3 Completion Time: 13.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 12.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

---------------------------

Time Step 17

---------------------------

***Adding a new Process Process Name: Process6 Completion Time: 3.131933765050175***

***Current Process Process Name: Process3 Completion Time: 12.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 11.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

---------------------------

Time Step 18

---------------------------

***Current Process Process Name: Process3 Completion Time: 11.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 10.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

---------------------------

Time Step 19

---------------------------

***Adding a new Process Process Name: Process7 Completion Time: 8.836364654497665***

***Current Process Process Name: Process3 Completion Time: 10.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 9.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

---------------------------

Time Step 20

---------------------------

***Adding a new Process Process Name: Process8 Completion Time: 11.102678058945164***

***Current Process Process Name: Process3 Completion Time: 9.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 8.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

---------------------------

Time Step 21

---------------------------

***Adding a new Process Process Name: Process9 Completion Time: 10.71699362560612***

***Current Process Process Name: Process3 Completion Time: 8.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 7.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

---------------------------

Time Step 22

---------------------------

***Current Process Process Name: Process3 Completion Time: 7.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 6.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

---------------------------

Time Step 23

---------------------------

***Current Process Process Name: Process3 Completion Time: 6.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 5.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

---------------------------

Time Step 24

---------------------------

***Current Process Process Name: Process3 Completion Time: 5.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 4.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

---------------------------

Time Step 25

---------------------------

***Current Process Process Name: Process3 Completion Time: 4.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 3.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

---------------------------

Time Step 26

---------------------------

***Adding a new Process Process Name: Process10 Completion Time: 6.378047723810189***

***Current Process Process Name: Process3 Completion Time: 3.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 2.384343172978909***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

---------------------------

Time Step 27

---------------------------

***Adding a new Process Process Name: Process11 Completion Time: 2.3695120975249573***

***Current Process Process Name: Process3 Completion Time: 2.384343172978909***

***Updating Completion Time Process Name: Process3 Completion Time: 1.3843431729789089***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

---------------------------

Time Step 28

---------------------------

***Current Process Process Name: Process3 Completion Time: 1.3843431729789089***

***Updating Completion Time Process Name: Process3 Completion Time: 0.38434317297890885***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

---------------------------

Time Step 29

---------------------------

***Adding a new Process Process Name: Process12 Completion Time: 14.651153475837111***

***Current Process Process Name: Process3 Completion Time: 0.38434317297890885***

***Updating Completion Time Process Name: Process3 Completion Time: 0.0***

***Current Process Queue***

Process Name: Process4 Completion Time: 1.7423775117100637

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

---------------------------

Time Step 30

---------------------------

***Current Process Complete***

***New current process Process Name: Process4 Completion Time: 1.7423775117100637***

***Current Process Queue***

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

---------------------------

Time Step 31

---------------------------

***Current Process Process Name: Process4 Completion Time: 1.7423775117100637***

***Updating Completion Time Process Name: Process4 Completion Time: 0.7423775117100637***

***Current Process Queue***

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

---------------------------

Time Step 32

---------------------------

***Adding a new Process Process Name: Process13 Completion Time: 9.898589698658695***

***Current Process Process Name: Process4 Completion Time: 0.7423775117100637***

***Updating Completion Time Process Name: Process4 Completion Time: 0.0***

***Current Process Queue***

Process Name: Process5 Completion Time: 10.03799757890731

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

---------------------------

Time Step 33

---------------------------

***Current Process Complete***

***New current process Process Name: Process5 Completion Time: 10.03799757890731***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

---------------------------

Time Step 34

---------------------------

***Current Process Process Name: Process5 Completion Time: 10.03799757890731***

***Updating Completion Time Process Name: Process5 Completion Time: 9.03799757890731***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

---------------------------

Time Step 35

---------------------------

***Adding a new Process Process Name: Process14 Completion Time: 0.4854788654270631***

***Current Process Process Name: Process5 Completion Time: 9.03799757890731***

***Updating Completion Time Process Name: Process5 Completion Time: 8.03799757890731***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

---------------------------

Time Step 36

---------------------------

***Adding a new Process Process Name: Process15 Completion Time: 14.048683911108137***

***Current Process Process Name: Process5 Completion Time: 8.03799757890731***

***Updating Completion Time Process Name: Process5 Completion Time: 7.03799757890731***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

---------------------------

Time Step 37

---------------------------

***Adding a new Process Process Name: Process16 Completion Time: 13.564303723296447***

***Current Process Process Name: Process5 Completion Time: 7.03799757890731***

***Updating Completion Time Process Name: Process5 Completion Time: 6.03799757890731***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

---------------------------

Time Step 38

---------------------------

***Current Process Process Name: Process5 Completion Time: 6.03799757890731***

***Updating Completion Time Process Name: Process5 Completion Time: 5.03799757890731***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

---------------------------

Time Step 39

---------------------------

***Current Process Process Name: Process5 Completion Time: 5.03799757890731***

***Updating Completion Time Process Name: Process5 Completion Time: 4.03799757890731***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

---------------------------

Time Step 40

---------------------------

***Current Process Process Name: Process5 Completion Time: 4.03799757890731***

***Updating Completion Time Process Name: Process5 Completion Time: 3.0379975789073104***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

---------------------------

Time Step 41

---------------------------

***Adding a new Process Process Name: Process17 Completion Time: 6.959902263530519***

***Current Process Process Name: Process5 Completion Time: 3.0379975789073104***

***Updating Completion Time Process Name: Process5 Completion Time: 2.0379975789073104***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

Process Name: Process17 Completion Time: 6.959902263530519

---------------------------

Time Step 42

---------------------------

***Current Process Process Name: Process5 Completion Time: 2.0379975789073104***

***Updating Completion Time Process Name: Process5 Completion Time: 1.0379975789073104***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

Process Name: Process17 Completion Time: 6.959902263530519

---------------------------

Time Step 43

---------------------------

***Current Process Process Name: Process5 Completion Time: 1.0379975789073104***

***Updating Completion Time Process Name: Process5 Completion Time: 0.03799757890731037***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

Process Name: Process17 Completion Time: 6.959902263530519

---------------------------

Time Step 44

---------------------------

***Current Process Process Name: Process5 Completion Time: 0.03799757890731037***

***Updating Completion Time Process Name: Process5 Completion Time: 0.0***

***Current Process Queue***

Process Name: Process6 Completion Time: 3.131933765050175

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

Process Name: Process17 Completion Time: 6.959902263530519

---------------------------

Time Step 45

---------------------------

***Current Process Complete***

***New current process Process Name: Process6 Completion Time: 3.131933765050175***

***Current Process Queue***

Process Name: Process7 Completion Time: 8.836364654497665

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

Process Name: Process17 Completion Time: 6.959902263530519

---------------------------

Time Step 46

---------------------------

***Adding a new Process Process Name: Process18 Completion Time: 12.128243531992108***

***Cancelling current Process***

***Current Process Process Name: Process7 Completion Time: 8.836364654497665***

***Updating Completion Time Process Name: Process7 Completion Time: 7.836364654497665***

***Current Process Queue***

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

Process Name: Process17 Completion Time: 6.959902263530519

Process Name: Process18 Completion Time: 12.128243531992108

---------------------------

Time Step 47

---------------------------

***Current Process Process Name: Process7 Completion Time: 7.836364654497665***

***Updating Completion Time Process Name: Process7 Completion Time: 6.836364654497665***

***Current Process Queue***

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

Process Name: Process17 Completion Time: 6.959902263530519

Process Name: Process18 Completion Time: 12.128243531992108

---------------------------

Time Step 48

---------------------------

***Current Process Process Name: Process7 Completion Time: 6.836364654497665***

***Updating Completion Time Process Name: Process7 Completion Time: 5.836364654497665***

***Current Process Queue***

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

Process Name: Process17 Completion Time: 6.959902263530519

Process Name: Process18 Completion Time: 12.128243531992108

---------------------------

Time Step 49

---------------------------

***Adding a new Process Process Name: Process19 Completion Time: 1.4169154838875002***

***Current Process Process Name: Process7 Completion Time: 5.836364654497665***

***Updating Completion Time Process Name: Process7 Completion Time: 4.836364654497665***

***Current Process Queue***

Process Name: Process8 Completion Time: 11.102678058945164

Process Name: Process9 Completion Time: 10.71699362560612

Process Name: Process10 Completion Time: 6.378047723810189

Process Name: Process11 Completion Time: 2.3695120975249573

Process Name: Process12 Completion Time: 14.651153475837111

Process Name: Process13 Completion Time: 9.898589698658695

Process Name: Process14 Completion Time: 0.4854788654270631

Process Name: Process15 Completion Time: 14.048683911108137

Process Name: Process16 Completion Time: 13.564303723296447

Process Name: Process17 Completion Time: 6.959902263530519

Process Name: Process18 Completion Time: 12.128243531992108

Process Name: Process19 Completion Time: 1.4169154838875002

 

Solution Tests:

  1. Is your name written as a comment in all source files?
  2. Does the solution compile (no syntax errors)?
  3. Does the output match the example dialog?

 

Lab Report

  1. Create a section named “Problem” and describe this lab’s problem in your own words. (10pts).
  2. Create a section named “Solution Description” and describe how the code solves the problem in your own words. (10pts).
  3. Create a section named “Problems Encountered” and describe the various syntax, run-time, and logic errors that were encountered while implementing the solution. (10pts)
  4. How is a queue structured? (10pts)
  5. Describe when it is most appropriate to use a Queue in a problem. (10pts)
  6. Detail two ways Queues are commonly used in computing. (10pts)
  7. What are the values in the queue following these actions? The answer must clearly show the “head” and “tail” values. (10pts)

 

ENQUEUE Values 1, 2, 3, 4, 5

DEQUEUE 3 times

ENQUEUE Values 25, 35, 45, 55

DEQUEUE 1 time

ENQUEUE Value 22

 

  1. Assuming the following is a Queue of Strings implemented as a circular array, show the resulting array after the following actions. The answer must clearly show the “head” and “tail” values. (10pts)

 

String Queue Circular Array

Ref

 

Tail

 

 

 

 

Head

 

 

Index

0

1

2

3

4

5

6

7

8

Value

“d”

“e”

NULL

NULL

NULL

NULL

“a”

“b”

“c”

 

Actions

ENQUEUE Values “j”, “k”

DEQUEUE 2 Times

ENQUEUE Values “m”, “n”, “o”

DEQUEUE 3 Times

 

  1. Given the following code snippet for a circular array implementation of a Queue of data-type double, the method is supposed to print out ever other value starting with the head. For instance, if the Queue had the values <1,2,3,4,5> then the method should print “1, 3, 5”, but it does not work. Describe ways to fix this method so that it behaves are intended. You may assume that the “head” property references the first element in the queue and the “tail” property references the first empty spot in the queue. (10pts)

  1. Given the following code snippet for a linked list implementation of a Queue of data-type integer, the method is meant to search the queue to see if a value is contained and returns true or false respectively. However, the method is not functioning correctly, so describe ways to fix this method so that it behaves are intended. (10pts)

 

Finally

Upload the Lab Solution’s source code (.JAVA file(s)) and the Lab Report’s text file to the CSCE Dropbox.