Question: Need help with a problem in scheme In the IT Department of the Magrathean Construction Company, there are four work shifts during the day: 9:00-11:00,
Need help with a problem in scheme
In the IT Department of the Magrathean Construction Company, there are four work shifts during the day: 9:00-11:00, 11:00-1:00, 1:00-3:00, and 3:00-5:00. During each shift, four workers are needed: Two to answer customers' questions on the phone, one to repair computers, and one to fix network problems. No worker can work more than one job or shift during a day. Thus, it takes 16 different workers to fill all the jobs during a day.
The various employees of the company have different skills: some are good at answering phones, some are good at repairing computers, some are good at fixing network problems, and some are good at more than one of these tasks. An employee should only be assigned to a job if he/she has that job skill.
The input to your program will be a proposed job assignment (the phone, computer, and network workers for each of the four shifts), followed by a list of workers and their skills. The workers and their skills will be specified by a worker's name, then three numbers (1 or 0) indicating whether the person is good at answering phones, repairing computers, and fixing the network, in that order. 1 indicates that the employee has the skill, and 0 indicates that the employee does not have the skill.
The output will be a message indicating whether the proposed job assignment is acceptable.
1.
Write a Scheme program to solve the problem described above. Define a function (jobs_ok? Assignment Employees) which takes two parameters, Assignment and Employees. Assignment is a list of four sub-lists, one for each shift; each sub-list contains the work assignment for that shift: 2 names for phones, followed by one for computer repair, followed by one for network repair. Employees is a list of sub-lists; each sub-list contains an employee's name, followed by three integers (1 or 0) indicating whether the employee is qualified for phones, computers, and networks, respectively. The function should return #T if the job assignment is acceptable and return #F if the job assignment is not acceptable
You may assume that the Assignment and Employees lists will be in the correct format when the function is called; you do not have to error-check for a non-list or an incorrectly formed list. In your program, you may write and call any additional functions that are helpful in the computation.
Examples:
(jobs_ok?
'(
(Park Dunbar Khan Lloyd)
(Bashir Trivedi Ramos Franklin)
(Schmidt Nakamura Andrews Chen)
(Evans Goldberg Macmillan Ortiz))
'(
(Andrews 1 1 1)
(Bashir 1 1 1)
(Chen 1 1 1)
(Dunbar 1 1 1)
(Evans 1 1 1)
(Franklin 1 1 1)
(Goldberg 1 1 1)
(Jefferson 1 1 1)
(Khan 1 1 1)
(Lloyd 1 1 1)
(Macmillan 1 1 1)
(Nakamura 1 1 1)
(Ortiz 1 1 1)
(Park 1 1 1)
(Ramos 1 1 1)
(Schmidt 1 1 1)
(Trivedi 1 1 1)))
should return #T, and
(jobs_ok?
'(
(Young Collins Vieira Liu)
(Davis Ericson Kelly Singh)
(Fitzgerald Gutierrez Martinez Tortorella)
(Nguyen Jones Patel Zimmerman))
'(
(Aziz 1 0 0)
(Blumenthal 0 1 1)
(Collins 1 1 1)
(Davis 1 0 0)
(Ericson 1 0 0)
(Fitzgerald 1 0 1)
(Gutierrez 1 0 1)
(Jones 1 1 1)
(Kelly 0 1 1)
(Liu 1 0 1)
(Martinez 0 1 1)
(Nguyen 1 0 0)
(Patel 1 1 1)
(Qureshi 1 1 0)
(Rodriguez 1 0 0)
(Singh 0 1 1)
(Tortorella 0 0 1)
(Vieira 0 1 0)
(Young 0 1 0)
(Zimmerman 1 1 1)))
should return #F.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
