我有一段 java程序需要完善
/**
工件类
*/
class WorkPiece
{
public boolean isProcessing = false;//是否在被加工中
public boolean Processed[5] = false;//机床加工完成
public int workertime[5];//机床加工时间
public int starttime[5];//每个机床上开始时间点
public int endtime[5];//每台机床加工结束时间
//开始加工
public startworked(int workernum, int time)
{
isProcessing=true;
starttime[workernum]=time;
}
//结束加工
public endworked(int workernum, int time)
{
isProcessing=false;
endtime[workernum]=time;
Processed[workernum] = true;
}
}
/**
机床类
*/
class Worker
{
public boolean isworking = false;//是否在工作中
public WorkPiece;//这台机床上正在被加工的工件
public int worklongth;//加工中工件已加工时长
public int starttime;//正在加工的开始时间
}
/**
加工场
*/
Class Factory
{
WorkPiece toprocessworkpiece =workpiece[0] ;
Worker toprocessworker;
int time = 0;//总工作时长
WorkPiece workpiece[4];
WorkPiece workpiece[0] = new WorkPiece();
WorkPiece workpiece[1]= new WorkPiece();
WorkPiece workpiece[2]= new WorkPiece();
WorkPiece workpiece[3]= new WorkPiece();
Worker work[5]
Worker work[0] = new Worker();
Worker work[1] = new Worker();
Worker work[2] = new Worker();
Worker work[3] = new Worker();
Worker work[4] = new Worker();
public void work()
{
//把机床加工时间付给每个工件
workpiece[1].workertime[0] =155;