I'm creating a tv schedule for a hotel and need to be able to fill the schedule with particular programs that take up various amounts of time each slot is 30 mins so a film with a 1hr 30 min run time would take up 3 slots but i'm not sure how to go about doing this. i've created a boolean array that would have the slots and if a show takes up 3 slots it will set the values of the boolean array to true and then the user would no longer be able to use those slots. I'm a bit confused as how to go about this though.
import java.util.*;
public class Schedule {
private int maxduration = 18*2;
private ArrayList<Programme>schedule;
private boolean [] times;
public Schedule() {
schedule = new ArrayList<Programme>();
times= new boolean[maxduration];
}
public boolean[] getTimes() {
return times;
}
public void setTimes(boolean[] times) {
this.times = times;
}
public void addProgramme(int statTime, Programme p)
{
schedule.add(p);
}
public void printSchedule()
{
System.out.println(schedule);
}
public void removeProgramme(String title){
Programme prog = null;
for(Programme p: schedule){
if(p.getTitle().equals(title)){
prog = p;
break;
}
}
schedule.remove(prog);
}
}