Hey this is Mohamed Shahabudeen. Can someone please help me with the following!
Enter the following program called “composers.pro”
% This database is about composers
% Datarecords: composer’s last name, birth and death year
composer (monteverdi, 1567, 1643).
composer (bach, 1685, 1750).
composer (vivaldi, 1678, 1741).
composer (mozart, 1756, 1791).
composer (haydn, 1732, 1809).
composer (beethoven, 1770, 1827).
composer (kreisler, 1875, 1962).
composer (salieri, 1750, 1825).
composer (sammartini, 1700, 1775).
composer (scarlatti, 1660, 1725).
composer (schubert, 1797, 1828).
composer (schumann, 1810, 1856).
composer (tchaikovsky, 1840, 1893).
composer (brahms, 1833, 1897).
composer (verdi, 1813, 1901).
composer (debussy, 1862, 1918).
composer (stravinksy, 1882, 1971).
composer (wagner, 1813, 1883).
composer (chopin, 1810, 1849).
composer (corelli, 1653, 1713).
composer (copland, 1890, 1990).
% composer X is a contemporary of composer Y is the range of years during which they were alive overlap
contemporary (X,Y) :-
composer (X, B1, D1), composer (Y, B2, D2) , X \ = Y, overlap (B1, D1, B2, D2).
overlap (B1, D1, B2, D2). :- B2 >= B1, B2 =< D1.
overlap (B1, D1, B2, D2). :- B1 >= B2, B1 =< D2.
alive_during (Composer, Year) :-
composer (Composer, B1, D1), overlap (B1, D1, Year, Year).
a. Use the program to find all contemporaries of Bach, Verdi, and Copeland.
b. The Baroque era of classical music extends from 1600 to 1750. Write a predicate baroque/1, i.e., executed as baroque(X) where X is a particular name, that determines whether that composer belongs to the baroque era or not.) Prolog will answer “yes” or “no”. The predicate uses the database of composers shown above.
Thank you
Mohamed Shahabudeen