@@ -0,0 +1,1614 @@
+package PostOffice;%0Aimport java.io.*;%0Aclass node%0A%7B%0A%09protected node link;%0A%09protected String data;%0A%09%0A%09public node(String a, node b)%0A%09%7B%0A%09%09data = a;%0A%09%09link = b;%0A%09%7D%0A%09%0A%09public void setdata(String x)%0A%09%7B%0A%09%09data = x;%0A%09%7D%0A%09public void setlink(node z)%0A%09%7B%0A%09%09link = z;%0A%09%7D%0A%09public String getdata()%0A%09%7B%0A%09%09return data;%0A%09%7D%0A%09public node getlink()%0A%09%7B%0A%09%09return link;%0A%09%7D%0A%7D%0Aclass linkedlist %0A%7B%0A%09protected node start;%0A%09protected static linkedlist Link;%0A%09%0A%09void linkedlist()%0A%09%7B%0A%09%09start = null;%0A%09%7D%0A%09%0A%09public boolean isEmpty()%0A%09%7B%0A%09%09return(start == null);%0A%09%7D%0A%09%0A%09public void insert(String code)%0A%09%7B%0A%09%09node nptr, ptr, save = null;%0A%09%09nptr = new node(code, null);%0A%09%09boolean flag = false;%0A%0A%09%09if(isEmpty())%0A%09%09start = nptr;%0A%09%09else if(code.compareTo(start.getdata()) %3C 1)%0A%09%09%7B%0A%09%09%09nptr.setlink(start);%0A%09%09%09start = nptr;%0A%09%09%7D%0A%09%09else%0A%09%09%7B%0A%09%09%09save = start;%0A%09%09%09ptr = start.getlink();%0A%09%09%09while(ptr != null)%0A%09%09%09%7B%0A%09%09%09%09if((nptr.getdata().compareTo(save.getdata())) %3E 1 && (nptr.getdata().compareTo(ptr.getdata())) %3C 1)%0A%09%09%09%09%7B%0A%09%09%09%09%09save.setlink(nptr);%0A%09%09%09%09%09nptr.setlink(ptr);%0A%09%09%09%09%09flag = true;%0A%09%09%09%09%09break;%0A%09%09%09%09%7D%0A%09%09%09%09else%0A%09%09%09%09%7B%0A%09%09%09%09%09save = ptr;%0A%09%09%09%09%09ptr = ptr.getlink();%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09if(flag == false)%0A%09%09    save.setlink(nptr);%0A%09%09%7D%0A%09%09%0A%09%7D%0A%09%0A%09public void writeToFile() throws IOException%0A%09%7B%0A%09%09String code = %22%22;%0A%09%09node ptr;%0A%09%09%0A%09%09FileWriter fout = new FileWriter(%22log.txt%22);%0A%09%09BufferedWriter bout = new BufferedWriter(fout);%0A%09%09PrintWriter out = new PrintWriter(bout);%0A%09%09%0A%09%09if(!isEmpty())%0A%09%09%7B%0A%09%09%09out.println(start.getdata());%0A%09%09%09ptr = start.getlink();%0A%09%09%09%0A%09%09%09while(ptr != null)%0A%09%09%09%7B%0A%09%09%09%09out.println(ptr.getdata());%0A%09%09%09%09ptr = ptr.getlink();%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09out.close();%0A%09%7D%0A%7D%0A

Create link.java