Calculating Delay for each job | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Calculating Delay for each job

I have algorithms and I can’t solve it in java code The algorithm wants to calculate the delay time for each job And I will write the each job in array And i have 3 jobs

18th Feb 2018, 2:24 PM
nada
8 Answers
0
can you elaborate on the question? The question is unclear.
18th Feb 2018, 2:28 PM
Syed Muhammad Dawoud Sheraz Ali
Syed Muhammad Dawoud Sheraz Ali - avatar
0
C0=0.0; /assume that a=0.0 / I=0; While (more jobs to process) { I++ ; a=GetArrival(); If (a<ci-1) d=ci-1 -a; Else d=0.0; S=Getservice(); Ci=a+d+s; } n=i; Return d1,d2,.....,dn;
19th Feb 2018, 9:34 AM
nada
0
That is the algorithm
19th Feb 2018, 9:35 AM
nada
0
for the delay, use time module and its functions and get the difference at start and end.
19th Feb 2018, 9:45 AM
Syed Muhammad Dawoud Sheraz Ali
Syed Muhammad Dawoud Sheraz Ali - avatar
0
I don’t understand you 💔😭
19th Feb 2018, 9:59 AM
nada
0
is delay fixed for each job? because the statement d=c[i]-1-a is confusing. what does c[] holds? whats "a"?
19th Feb 2018, 10:01 AM
Syed Muhammad Dawoud Sheraz Ali
Syed Muhammad Dawoud Sheraz Ali - avatar
0
There are array for a ,d, s But really I don’t understand the algorithm and how I will write it in java
19th Feb 2018, 11:03 AM
nada
0
from what I understand from code, the delay is for some special cases. Some variables are unclear. but GetArrival can be the job start time and based on what the value is, the IF condition determines the delay. consult the documentation instead of code to understand the algo. The pseudocode is very badly written.
19th Feb 2018, 11:31 AM
Syed Muhammad Dawoud Sheraz Ali
Syed Muhammad Dawoud Sheraz Ali - avatar