CS 1401, Quiz 13
(based on Test 4), TR version
Date: Thursday, December 5, 2013
Name (please type legibly, ideally in block letters):
______________________________________________________________________
1. Suppose that a class Programmer has already been defined,
whose objects are different programmers. The description of each
programmer contains:
- his or her name,
- the number of
lines of code this programmer wrote, and
- the amount of time
(in days) that the programmer has worked for the company.
As
usual, this class contains: - a constructor method,
-
get- and set-methods, and
- a method for computing the
programmer's productivity -- which is defined as the number of
lines of code divided by the number of days.
1a. Write a method that, given an array of programmers, returns the
name of the most productive programmer.
1b. In the main program, create an array s consisting of two
new objects of type Programmer:
- an object
describing Mario who programmed 2,200 lines of code in 40 days, and
- an object describing Lauren who programmed 3,000 lines of code
in 15 days.
1c. In the main program, apply your method to the array s,
and trace the resulting code step-by-step.