Objectives
Getting Started

Download and import starter code for W6L1.

After you have completed this, your directory should look like:

W6L1/
├── resources
│   └── employees.txt
└── src
    └── Employee.java
Introduction

A company has the following types of employees: programmers, and testers.

This is represented using the following class hierarchy:

       Employee
       /      \
Programmer    Tester
Note
while in this recitation we establish productivity as the number of lines of code a programmer or tester produces, we recognize that this isn’t a true metric of productivity. This is just an exercise. Programming is mostly about thinking, not typing.

Each employee has some base functionality like a name and an average amount of work they can produce. Then, depending on whether the employee is a programmer or tester, he or she produces a certain amount of work each day. You will be implementing this functionality in the following sections.

Part One
  1. Employee is an abstract class that represents the notion of an employee. Use the javadoc to fill in the rest of the methods for the Employee class.

    • Because your fields have the final modifier, your class will have a compilation error until you have assigned them values in the constructor.

  2. Create a new class called Programmer

    • The Programmer class is a concrete class of abstract Employee class. You will be implementing a constructor and the work method. Use the javadoc for implementation details.

  3. Create a new class called Tester

    • The Tester class is a concrete class of abstract Employee class. You will be implementing a constructor and the work method. Use the javadoc for implementation details.

Part Two

The three classes in Part One represent our hierarchy. Once you have finished implementing these classes, download the Project class.

  1. Open the class and look over the code that’s already there. Make sure you understand what each instance variable is doing.

  2. Complete the following methods in the Project class:

Notice that there are two constructors. We are calling the constructor that gives back random data. The second constructor sets a seed and allows us to have reproducible results.

First, try running the program several times. See how the names and the average productivity changes each time.

To make sure you are producing the same results as us, add 10 as a last argument to your the Project constructor call in the main method, like this:

Project p1 = new Project(5000, 15, 10, 10);

Now the names and average productivity will be set and you should see the following results.

Deadline: 15
Days required: 14
Employees on Project:
Programmer Rosaline Barcia, average productivity: 148 lines
Programmer Clint Earls, average productivity: 62 lines
Programmer Arlette Cormack, average productivity: 105 lines
Programmer Charles Odem, average productivity: 71 lines
Tester Shon Selle, average productivity: 132 lines
Tester Garth Goates, average productivity: 127 lines
Tester Jacinto Farrah, average productivity: 114 lines
  1. Finally, in the main method create two additional projects by instantiating the objects, calling the completeProject method and printing the resulting toString.

Additional Considerations
  1. Check out the additional restrictions in the completeProject method, if you have time

  2. More programmers does not equal increased productivity. How would you implement a mathematical model that could reflect the project productivity depending on how many programmers had been assigned to the problem? What would this look like?

Submission

To get credit for this recitation show that you get the same output as shown above and that you have tried creating two additional projects.