title: Circular Queue in Java
body: <p>I am implemeting a circular queue in java which will accept objects (Employee) as entries. Now I have a method to edit the surname of the specific object, but somehow I cannot access the surname setter method found in the <code>Employee</code> class from the <code>CQueue</code> class even though I am importing all the required packages. Here is the code:</p>
  
  <pre><code>//PACKAGES IMPORTED
  package linearstructures;
  import dataobjects.*;
  import linearnodes.*;
  
  public class CQueue{
      Node front, rear, temp;
      boolean full = false;
      String key;
  
  public AnyClass searchKey(String key)
  {
      temp = rear.next; // first node
  
      do
      {
          if (temp.obj.getKey().equals(key))
              return temp.obj;
          temp = temp.next;
      } while (temp != rear.next);
  
      return null;
  }
  
  public AnyClass editObject(String key){
      int choice, newSeqNo;
      double newPay;
      boolean exit = false;
      Employee etemp = new Employee(); //INCLUDED THIS AFTER EDIT
      searchKey(key);
  
      if(searchKey(key) != null){
          temp.obj.getData();
          System.out.println();
          System.out.println("------------------------");
          System.out.print("Enter new Salary: ");
          newPay = sc.nextDouble();
          System.out.println("------------------------");
          System.out.println();
          etemp.setPay(newPay); //INCLUDED THIS AFTER EDIT
      else
          System.out.println("NO OBJECT WAS FOUND!");
      return null;
  }
  }
  </code></pre>
  
  <p><code>Employee</code> class:</p>
  
  <pre><code>package dataobjects;
  
  public class Employee extends AnyClass
  {
  public String surname;
  public double pay;
  
  public Employee(){}
  
  public Employee(int seqNo, String surname, double pay)
  {
      super(seqNo);
      this.surname = surname;
      this.pay = pay;
  }
  
  public double getSalary()
  {
      return pay;
  }
  
  public void setPay(double newPay)
  {
      pay = newPay;
  }
  
  public String getData()
  {
      return super.getData() + ", Surname: " + surname + ", Pay: " + pay;
  }
  
  public String getKey()
  {
      return surname;
  }
  }
  </code></pre>
  
  <p><code>AnyClass</code> class:</p>
  
  <pre><code>package dataobjects;
  
  public class AnyClass
  {
  public int seqNo;
  
  public AnyClass(){}
  
  public AnyClass(int seqNo)
  {
      this.seqNo = seqNo;
  }
  
  public int getseqNo()
  {
      return seqNo;
  }
  
  public void setseqNo(int seqNo) {
      this.seqNo = seqNo;
  }
  
  public String getData()
  {
  
      return "Sequential Number - " + seqNo;
  }
  
  public String getKey()
  {
      return Integer.toString(seqNo);     
  }
  
  public void edit(){}
  }
  </code></pre>
  
  <h2><code>Node</code> Class</h2>
  
  <pre><code>package linearnodes;
  import dataobjects.*;
  
  public class Node{
      public AnyClass obj;
      public Node next;
      public Node(AnyClass obj){
          next = null;
          this.obj = obj;
      }
  }
  </code></pre>