Answered step by step
Verified Expert Solution
Link Copied!

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:
1. The English person lived in the red house.
2. The Spaniard owned the dog.
3. The Japanese was a painter.
4. The Italian drank tea.
5. The Norwegian lived in the first house on the left.
6. The owner of the green house drank coffee.
7. The green house was on the right of the white one.
8. The sculptor was breeding snails.
9. The diplomat lived in the yellow house.
10. Milk was drunk in the middle house.
11. The Norwegian lived next to the blue house.
12. The violinist drank fruit juice.
13. The fox was in the house next to that of the doctor.
14. The horse was in the house next to that of the diplomat.
Obi-Wan 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 jobHouse[Jobs]
int animalHouse[Animals]
int drinkHouse[Drinks]
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 0 to 4, from left to right in the street.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions