
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

The first quiz for the course will be on Wed, Sep 17. The following list provides more information about the quiz:
The following exercises cover the material to be included in this quiz. Solutions to these exercises will not be provided, but you are welcome to discuss your solutions with the TA or instructor during office hours.
Exercises
public class PrinterJob { private int id; private int size;
public PrinterJob(int id, int size) { this.id = id; this.size = size; }
public int getId() { return id; }
public int getSize() { return size; }
public String toString() { return "Id: " + id + " Size: " + size; }
public int hashCode() { return id; } }
a. Add a new private field “jobType” as an enumerated type with the values COLOR and BW.
b. Add an equals method that overrides the Object class equals method.
c. Modify the class so it implements the Comparable interface, allowing you to compare PrinterJob objects based on their id.
d. Implement a comparator class named sizeComparator that allow us to compare PrinterJob objects based on their size.