Anyone to help please? I am trying to simulate a program for two students who decide to revise a course unit and watch TV as well. The first part is giving me a hell of a problem. I have tried and now must confess that i need some guidance. Attached are my student codes and unit codes. Please could anyone suggest possible ways to move on? Thanks in advance.
CODE
public class Student extends Thread {
private int id; // student id; can take the values 1 or 2
private Unit unit; // the Unit they are studying
// code for two-argument constructor
int id1=student1;
int id2=student2;
public void run() {
for (int session = 1; session < 4; session++) {
unit.revise(id,session);
System.out.println("Student " + id + " has TV break number " + session);
try {
Thread.sleep(5);
}catch (InterruptedException e) {}
}
}
public static void main(String[] args) {
Unit courseUnit = new Unit();
// code to create and start two threads (the students)
Student student1=new Student();
Student student2=new Student();
}
}
src.zip ( 755bytes )
Number of downloads: 24
src.zip ( 755bytes )
Number of downloads: 24
src.zip ( 755bytes )
Number of downloads: 24