TASK

You will write a program which checks a work assignment against a collection of constraints to see whether the work assignment is acceptable.

At the Seagull Swimming Pool, there are three work shifts during the day: 12:00-2:00, 2:00-4:00, and 4:00-6:00. During each shift, five workers are needed: two lifeguards, two people to run the snack bar, and one person to sit at the front desk. No worker can do more than one job during a single shift, though workers can work multiple shifts during the day.

Some of the employees have the qualifications to be a lifeguard, and only qualified lifeguards are allowed to work as lifeguards. Anyone can work at the snack bar or front desk.

Each of the employees has a minimum and maximum number of shifts that they should work during the day. These numbers are different for different employees.

The input to your program will be a proposed job assignment (the two lifeguards, the two snack bar workers, and the front desk worker, for each of the three shifts), followed by a list of employees and their work constraint information. The employees and their information will be specified by an employee’s name, then a number (1 or 0) indicating whether the person is qualified to be a lifeguard (1=yes, 0=no), then two nonnegative integers indicating the minimum and maximum number of shifts the person can work. For example:

Olivia 1 0 2

indicates that Olivia is qualified to be a lifeguard and should work between 0 and 2 shifts — that is, she should work 0, 1, or 2 shifts.

Michael 0 2 3

indicates that Michael is not qualified to be a lifeguard and should work either 2 or 3 shifts.

Nick 1 2 2

indicates that Nick is qualified to be a lifeguard and should work exactly 2 shifts.

The output will be a message indicating whether the proposed job assignment is acceptable.


    Make your order right away

    Confidentiality and privacy guaranteed

    satisfaction guaranteed