Question: 5. a) Define a recursive function called comb in Prolog that takes at least two parameters: n, r and then computes the value of C.

5. a) Define a recursive function called comb in Prolog that takes at least two parameters: n, r and then computes the value of "C. (the number of ways r objects can be selected from n objects). OR b) Define a recursive function called numdigit in Prolog that takes at least one parameter: n and computes the number of digits in n. 6. a) Define a function called median in Prolog that takes at least three parameters: x,y,z and computes their median. For e.g. median of 3, 2, 5 is 3 because in sorted order 3 comes between 2 and 5. OR b) Define a function called leap in Prolog that takes at least one parameter: a year and evaluates to true if the year is a leap year and evaluates false otherwise. 7. Write a Java program that has a class called ECECoordinator which represents a coordinator (e.g. BSCSE/BSEEE/MS coordinator) of ECE department of NSU. Naturally, this class should have the following fields: ID, designation, extraHours, etc. Write the class in such a way that a user of this class cannot create more than k objects of this class, where k is a constant read from the ECE chairman. Before creating any object of this class, one must read and set the value of k in a member of this class. If anyone tries to create an object of this class before setting the value of k, then an error would be shown. Similarly, if one tries to create more than k objects, another error message would be shown
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
