public class Ringpuffer { private Object[] buf; /* add more variables here */ public Ringpuffer (int size) { buf = new Object[size]; /* fill code here to initialize buffer and other variables */ } /* return index position in our array for a given sequence number */ private int idx (int s) { /* fill code in here to compute index number */ return -1; // change this as neccessary! } /* return data of next packet in sequence, or 'null' if none available */ public Object getnextpacket() { /* fill code in here */ return null; // change this as neccessary! } /* return sequence number if this packet is acknowledged, * or -1 if no ACK is sent. */ public int storepacket (int s, Object data) { /* fill in here */ return s; // change this as neccessary! } /* Optional: return buffer state as string representation */ public String show () { return "."; } }