top of page
kentra52

Fire Department Work Schedule

The City of Mountain View California's fire department has a schedule of 2 days on and 4 days off. The shift starts at 08:00 and is 24 hours long. There are three teams, Red, Blue and Green who rotate through the days. What is the Point 85 code in Java, Python and C#?


In Java:

// Mountain View, CA fire schedule
WorkSchedule schedule = new WorkSchedule("Mountain View Fire", "Fire department schedule.  One 24 hour shift with three teams.");

// start at 08:00 for 24 hours
Shift shift = schedule.createShift("24 Hour", "24 hour shift", LocalTime.of(8, 0, 0), Duration.ofHours(24));

// rotation [2 on 4 off]
Rotation rotation = schedule.createRotation("ABC", "Shift rotation");
rotation.addSegment(shift, 2, 4);

// 4 teams, 2 day, 2 night
schedule.createTeam("A", "Green team", rotation, LocalDate.of(2022, 11, 1));
schedule.createTeam("B", "Blue team", rotation, LocalDate.of(2022, 11, 3));
schedule.createTeam("C", "Red team", rotation, LocalDate.of(2022, 11, 5));

In Python:

# Mountain View, CA fire schedule
schedule = WorkSchedule("Mountain View Fire", "Fire department schedule.  One 24 hour shift with three teams.")

# start at 08:00 for 24 hours
shift = schedule.createShift("24 Hour", "24 hour shift", time(8, 0, 0), timedelta(hours=24))

# rotation [2 on 4 off]
rotation = schedule.createRotation("ABC", "Shift rotation")
rotation.addSegment(shift, 2, 4)

# 4 teams, 2 day, 2 night
schedule.createTeam("A", "Green team", rotation, date(2022, 11, 1))
schedule.createTeam("B", "Blue team", rotation, date(2022, 11, 3))
schedule.createTeam("C", "Red team", rotation, date(2022, 11, 5)) In 

In C#:

// Mountain View, CA fire schedule
WorkSchedule schedule = new WorkSchedule("Mountain View Fire", "Fire department schedule.  One 24 hour shift with three teams.");

// start at 08:00 for 24 hours
Shift shift = schedule.CreateShift("24 Hour", "24 hour shift", new LocalTime(8, 0, 0), Duration.FromHours(24));

// rotation [2 on 4 off]
Rotation rotation = schedule.CreateRotation("ABC", "Shift rotation");
rotation.AddSegment(shift, 2, 4);

// 4 teams, 2 day, 2 night
schedule.CreateTeam("A", "Green team", rotation, new LocalDate(2022, 11, 1));
schedule.CreateTeam("B", "Blue team", rotation, new LocalDate(2022, 11, 3));
schedule.CreateTeam("C", "Red team", rotation, new LocalDate(2022, 11, 5));


3 views0 comments

Comments


bottom of page