Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write the code in opl: As part of his training, Luke Skywalker must study ancient history, including the history of a blue planet in the
write the code in opl: As part of his training, Luke Skywalker must study ancient history, including the history of a blue planet in the milky way galaxy. People on that planet were very peculiar and Luke must solve a particular puzzling enigma. The problem is defined in terms of five people with different nationalities who lived in the first five houses of a street in the city of Atlanta. They practiced different professions, had each different favorite animals, and drank different beverages. Moreover, the houses were all painted in different colors. After some research in the archives, Luke gathered the following facts:
The English person lived in the red house.
The Spaniard owned the dog.
The Japanese was a painter.
The Italian drank tea.
The Norwegian lived in the first house on the left.
The owner of the green house drank coffee.
The green house was on the right of the white one.
The sculptor was breeding snails.
The diplomat lived in the yellow house.
Milk was drunk in the middle house.
The Norwegian lived next to the blue house.
The violinist drank fruit juice.
The fox was in the house next to that of the doctor.
The horse was in the house next to that of the diplomat.
ObiWan Kenobi wants to know who drank water and who owned the zebra on this strange blue planet. Can you help Luke find out? He can only use the following types of constraints and as well as reification.
The output must include at least the following three arrays
int jobHouseJobs
int animalHouseAnimals
int drinkHouseDrinks
where
string Jobs "painter", "diplomat", "violinist", "doctor", "sculptor" ;
string Animals dog "zebra", "fox", "snail", "horse" ;
string Drinks "juice", "water", "tea", "coffee", "milk" ;
Fill these arrays with the right values once your model is solved. The first array specifies the house of each job, the second the house of each animal, and the third one the house of each drink. Houses are numbered from to from left to right in the street.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started