java完成操作體系的短過程功課調劑示例分享。本站提示廣大學習愛好者:(java完成操作體系的短過程功課調劑示例分享)文章只能為提供參考,不一定能成為您想要的結果。以下是java完成操作體系的短過程功課調劑示例分享正文
package com;
import java.util.Arrays;
public class sjf {
public static void main(String[] args) {
sjf SJF=new sjf();
SJF.fun1();
}
int starttime;
int arrivetime;
int finishtime;
int zhouzhuan;
public void fun1(){
int a[]={1,3,2};
int c[]=new int[3];
for (int i = 0; i < 3; i++) {
c[i]=a[i];
}
Arrays.sort(c);
finishtime=a[0];
int[]d={0,3,3};
int zhouzhuan=finishtime-arrivetime;
float weightzhouzhuan=(float)zhouzhuan/a[0];//位權周轉時光為周轉時光h
System.out.println("開端時光"+starttime+"\t"+"達到時光"
+arrivetime+"\t"+"完成時光"+finishtime+"\t"+"周轉時光"+zhouzhuan+"\t"+"辦事時光"+a[0]+"\t"+"帶權周轉時光"+weightzhouzhuan);
for (int i = 1; i < 3; i++) {
arrivetime=d[i];
if(finishtime>=arrivetime){
starttime=finishtime;
finishtime+=c[i];
zhouzhuan=finishtime-arrivetime;
weightzhouzhuan=(float)zhouzhuan/c[i];
System.out.println("開端時光"+starttime+"\t"+"達到時光"
+arrivetime+"\t"+"完成時光"+finishtime+"\t"+"周轉時光"+zhouzhuan+"\t"+"辦事時光"+c[i]+"\t"+"帶權周轉時光"+weightzhouzhuan);
}else{
Arrays.sort(c);
starttime=arrivetime;
finishtime=starttime+c[i];
zhouzhuan=finishtime-arrivetime;
weightzhouzhuan=(float)zhouzhuan/c[i];
System.out.println("開端時光"+starttime+"\t"+"達到時光"
+arrivetime+"\t"+"完成時光"+finishtime+"\t"+"周轉時光"+zhouzhuan+"\t"+"辦事時光"+c[i]+"\t"+"帶權周轉時光"+weightzhouzhuan);
}
}
}
}