Okay, so I have an assign,ent to write a priority queue that implements a max heap. I've only just started the program and this is what I have for my MyMaxHeap class:

public class MyMaxHeap{ private static class jobAd{ public float salary; public float dist; public float score; public jobAd(float s, float d){ s = salary; d = dist; score = s + 3 * (30 - d); } } private jobAd[] theHeap; private int size; private int capacity; private static final int initial_cap = 5; public MyMaxHeap(){ size = 0; capacity = initial_cap; theHeap = new jobAd[capacity]; } public MyMaxHeap(jobAd[] arr, int n){ theHeap = arr; n = size; } public int size(){ return size; } public boolean add(jobAd job){ if ((size >= capacity) || (job == null)){ return false; } return true; } public static void main(String[] args){ MyMaxHeap myHeap = new MyMaxHeap(); System.out.println(myHeap.size()); } }

My problem here is that I don't understand how to add/insert a new new element to the list. I've tried a few things and they ended with several errors. Also, this heap is to be sorted by score. I don't know how to compare the two scores without using theHeap[index].score.compareTo(theHeap[index2] which also gives several errors. Please help!! I just need to know how to start this and then I'll work on it on my own. Thank you.