My main method is trying to start and terminate each and every thread in sequential order before it goes onto the next one on the line below. This means that the object guest0 is stuck waiting for one of the DeskEmployee objects to release a semaphore it has acquired, and the rest of the program simply fails to execute. How do I get it not to do this?
public static void main(String[] args) {
Project2 proj = new Project2();
Project2.Guest guest0 = proj.new Guest();
Project2.Guest guest1 = proj.new Guest();
Project2.Guest guest2 = proj.new Guest();
Project2.Guest guest3 = proj.new Guest();
Project2.Guest guest4 = proj.new Guest();
Project2.Guest guest5 = proj.new Guest();
Project2.Guest guest6 = proj.new Guest();
Project2.Guest guest7 = proj.new Guest();
Project2.Guest guest8=proj.new Guest();
Project2.Guest guest9 = proj.new Guest();
Project2.Guest guest10 = proj.new Guest();
Project2.Guest guest11 = proj.new Guest();
Project2.Guest guest12 = proj.new Guest();
Project2.Guest guest13 = proj.new Guest();
Project2.Guest guest14 = proj.new Guest();
Project2.Guest guest15 = proj.new Guest();
Project2.Guest guest16 = proj.new Guest();
Project2.Guest guest17 = proj.new Guest();
Project2.Guest guest18 = proj.new Guest();
Project2.Guest guest19 = proj.new Guest();
Project2.Guest guest20 = proj.new Guest();
Project2.Guest guest21 = proj.new Guest();
Project2.Guest guest22 = proj.new Guest();
Project2.Guest guest23 = proj.new Guest();
Project2.Guest guest24 = proj.new Guest();
Project2.DeskEmployee employee0=proj.new DeskEmployee(0);
Project2.DeskEmployee employee1=proj.new DeskEmployee(1);
Project2.Bellhop bellhop0=proj.new Bellhop(0);
Project2.Bellhop bellhop1=proj.new Bellhop(1);
guest1.run();
guest2.run();
guest3.run();
guest4.run();
guest5.run();
guest6.run();
guest7.run();
guest8.run();
guest9.run();
guest10.run();
guest11.run();
guest12.run();
guest13.run();
guest14.run();
guest15.run();
guest16.run();
guest17.run();
guest18.run();
guest19.run();
guest20.run();
guest21.run();
guest22.run();
guest23.run();
guest24.run();
employee0.run();
employee1.run();
bellhop0.run();
bellhop1.run();
}