Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Prolog program that solves the following logic puzzle, printing the rig

ID: 3831438 • Letter: C

Question

Create a Prolog program that solves the following logic puzzle, printing the right answer for each of the four cases.

There are 4 customers: Genevieve, Lucia, Shawna, Vanessa

There are 4 shoe sizes: 4,5,6,7

There are 4 shoe manufacturers: Abbott Hill, Manzarita, Graffetz, Williford

1. Of the Manzarita footwear and Lucia's pair, one was a size 7 and the other was a size 4.

2. Genevieve's pair was 2 sizes smaller than the Abbott Hill footwear.

3. Vanessa's pair was 2 sizes larger than Genevieve's pair.

4. The Graffetz footwear was somewhat larger than Shawna's pair.

For each customer, show their name, their shoe size and their shoe's manufacturer in a format similar to this:

Joe bought a size 13 Nike.

Tom bought a size 12 Reebok.

(etc.)

Explanation / Answer

In this prolog program, It examines total four cases.

I have written the following code which creates 4 cases by using the prolog switch statements by apllying the logic.

Program:-

Firstly create a instance of the cases i.e,

customer(customers, first) : Genevieve.
customer(customers, second) : Lucia.
customer(customers, third) : Shawna.
customer(customers, fourth) : Vanessa.
customer(shoeSize, first_one) : 4.
customer(shoeSize, first_two) : 5.
customer(shoeSize, first_three) : 6.
customer(shoeSize, first_four) : 7.
customer(shoeManufacturer, first_name) : Abbott Hill.
customer(shoeManufacturer, second_name) : Manzarita.
customer(shoeManufacturer, third_name) : Graffetz.
customer(shoeManufacturer, fourth_name) : Williford.

Finally, Its time to create a switch statement for displaying all the respective cases.

switch(n) {
  
case(firstCase(n)):
   cout << "Of the Manzarita footwear and Lucia's pair, one was a size 7 and the other was a size 4.";
   break;   
  
   case(secondCase(n)):
   cout << "Genevieve's pair was 2 sizes smaller than the Abbott Hill footwear.";
   break;   
  
   case(thirdCase(n)):
   cout << "Vanessa's pair was 2 sizes larger than Genevieve's pair.";
   break;   
  
   case(fourCase(n)):
   cout << "The Graffetz footwear was somewhat larger than Shawna's pair.";
   break;   

   }