// Arup Guha
// 10/28/2026
// Task class to use for Priority Queue example

import java.util.*;

public class Task implements Comparable<Task> {

	private String job;
	private int profit;
	
	public Task(String myJob, int myProfit) {
		job = myJob;
		profit = myProfit;
	}
	
	public int compareTo(Task other) {
	
		// First more money is better.
		if (this.profit != other.profit)
			return other.profit - this.profit;
			
		// for ties we do lexicographical comparison of task names.
		return job.compareTo(other.job);
	}
	
	// How we should print a task object.
	public String toString() {
		return job+" "+profit;
	}
}