1401, Quiz 12, MW 12-1:20 version
Date: Wednesday, November 20, 2013
Name (please type legibly, ideally in block letters):
In each department, the student-to-faculty ratio can be obtained by dividing the number of students by the number of faculty.
Write a method that, given:
returns the student-to-faculty ratio of this department.
For example, if the index is i = 2, the number of students in the corresponding department is students = 200 and
the number of faculty at this department is faculty = 10, your method should return 20.
Use try-catch to catch both possible exceptions:
- an array students containing the numbers of students in different departments,
- an array faculty containing the number of faculty in different departments, and
- the index i of the current department,
Return −1 if the first exception occurs and −2 if the second exception occurs.
- an exception arising when the index i is too large, larger than (or equal to)
the number of departments; and
- an exception arising when we try to divide by 0.