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

Write a program in Prolog that satisfies the criteria in the image below. The Al

ID: 3599638 • Letter: W

Question

Write a program in Prolog that satisfies the criteria in the image below.

The Allegro Music School is preparing the program for its Spring Recital. The school has two teachers, Ms. Smith and Mr. Jones, who teach students on a wide variety of instruments: Brass instruments: trumpet, trombone, tuba Woodwind instruments: flute, piccolo, clarinet, oboe Keyboard instruments: organ, piano String instruments: harp, violin, viola, cello In the Spring Recital, the school wants to arrange the order of student performances to meet three criteria: I. The teachers want to have the beginning students near the beginning of the recital, the intermediate students in the middle, and the advanced students at the end. Thus, the students will be in nondecrcasing order according to the number of years they have bee:n studying their instruments: Ist year students are followed by 2nd year students, and so on. Some years may be missing (i.e., it is possible to have no 2nd year students), but you may not have an advanced student followed by a beginnei. 2. To ensure variety in the recital, there must notb instruments from the same category next to each other in the recital order. That is, a brass player cannot be directly followed by another brass player, a keyboard player cannot be directly followed by another keyboard player, and so on 3. Each of the teachers (Smith and Jones) should have at least two students in the recital For your homework, you will write a program that will take as input a proposed list of students, with their instruments, teachers, and years of study; your program must decide whether this list is an acceptable order for the recital. Examples: Example 1: Adam, Trumpet, Smith, 1 Eve, Harp, Jones, 3 Abe, Oboe, Jones, 3 Sarah, Piano, Smith, 8 This is an acceptable recital order Example 2: Arthur, Flute, Jones, 2 Gwen, Cello, Jones, 2

Explanation / Answer

?- recital_ok([
     [ arthur, flute, jones, 2 ],
     [ gwen, cello, jones, 2 ],
     [ lance, flute, smith, 3 ],
     [ percy, viola, smith, 4 ],
     [ kay, trumpet, jones, 4 ],
     [ gary, cello, smith, 4 ] ]).
should succeed, and

?- recital_ok([
     [ henry, trombone, smith, 2 ],
     [ ed, tuba, jones, 2 ],
     [ mary, violin, smith, 2 ],
     [ elizabeth, piano, jones, 3 ] ]).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote