$29.99
Continuation from Assignment 2 (Part 1)
Attempt the following ONLY when Assignment-2-Part-1 problems are completed
6. Modify the code of Problem 2 (keep the code of problem 2 unchanged) and apply the concept of template function to demonstrate that different RuntimeSizeArray instances can be created for different data types, such as int, float, struct etc. However, understand that it cannot be instantiated for string (char *) data types.
7. Modify the Problem 2 (keep the code of problem 2 unchanged) in such way (without using template function) that different RuntimeSizeArray instance can be created for different data types, such as int, float, struct and string(char *).
8. Modify the code of Problem 5 (keep the copy of problem 5 unchanged) with following enhancements:
i) Before every iteration of the eviction process, the specified number of people (S) to be skipped is calculated based on an arbitrary function f(x) (where S = f(x)). For example, f(x) = (x3 – 2x2 + 4x – 1) or f(x) = (x2 – 3x + 6) where x is a natural number selected randomly.
ii) Provide a mechanism that in every iteration, the value of (specified number of people) S is calculated using a randomly chosen function among a set of given functions – f1(x), f2(x), f3(x) …, fm(x). Make sure these set of functions are encapsulated/hidden in a module, so that client code does not get a clue on selection of function.
iii) If the calculated S is a positive number, then direction of proceeding around the circle is clockwise, otherwise it is anticlockwise.