penfold69
asked on
error in code
when i try to compile this code i get an error on this line saying that
Method void add(int, String, String, int) requires a method body. Otherwise declare it as abstract.
public void add(int Position,String DocumentName,String Owner,int Size);
can someone please help?
the code to the whole program is below
separate class
class QueueNode
{
public int Position;
public String DocumentName;
public String Owner;
public int Size;
public QueueNode next;
public QueueNode previous;
}
import uuInOut;
class Queue extends QueueNode
{
QueueNode start;
QueueNode end;
public Queue()
{
start = new QueueNode();
start = null;
end = new QueueNode();
end = null;
}
public void add(int Position,String DocumentName,String Owner,int Size);
{
if (start ==null)
{
start=new QueueNode();
start.Position = uuInOut.ReadInt();
start.DcoumentName = uuInOut.ReadString();
start.Owner = uuInOut.ReadString();
start.Size = uuInOut.ReadInt();
start.next = null;
start.previous = null;
end = start;
}
else
{
QueueNode temp = new QueueNode();
temp.Position = uuInOut.ReadInt();
temp.DocumentName = uuInOut.ReadString();
temp.Owner = uuInOut.ReadString();
temp.Size = uuInOut.ReadInt();
temp.next = end;
end.previous = temp;
end = temp;
}
}
public boolean isEmpty()
{
return (start ==null);
}
public int remove()
{
QueueNode temp = new QueueNode();
if (start ==null)
return -1;
else if (start.previous ==null)
{
temp = start;
start = null;
return temp.Position;
return temp.DocumentName;
return temp.Owner;
return temp.Size;
}
else
{
temp = start;
start = start.previous;
return temp.Position;
return temp.DocumentName;
return temp.Owner;
return temp.Size;
}
}
public void displayAll()
{
QueueNode temp = new QueueNode();
temp = start;
while (temp !=null)
{
System.out.println(temp.Po sition);
System.out.println(temp.Do cumentName );
System.out.println(temp.Ow ner);
System.out.println(temp.Si ze);
temp = temp.previous;
}
}
}
thanks for any help!!!
Method void add(int, String, String, int) requires a method body. Otherwise declare it as abstract.
public void add(int Position,String DocumentName,String Owner,int Size);
can someone please help?
the code to the whole program is below
separate class
class QueueNode
{
public int Position;
public String DocumentName;
public String Owner;
public int Size;
public QueueNode next;
public QueueNode previous;
}
import uuInOut;
class Queue extends QueueNode
{
QueueNode start;
QueueNode end;
public Queue()
{
start = new QueueNode();
start = null;
end = new QueueNode();
end = null;
}
public void add(int Position,String DocumentName,String Owner,int Size);
{
if (start ==null)
{
start=new QueueNode();
start.Position = uuInOut.ReadInt();
start.DcoumentName = uuInOut.ReadString();
start.Owner = uuInOut.ReadString();
start.Size = uuInOut.ReadInt();
start.next = null;
start.previous = null;
end = start;
}
else
{
QueueNode temp = new QueueNode();
temp.Position = uuInOut.ReadInt();
temp.DocumentName = uuInOut.ReadString();
temp.Owner = uuInOut.ReadString();
temp.Size = uuInOut.ReadInt();
temp.next = end;
end.previous = temp;
end = temp;
}
}
public boolean isEmpty()
{
return (start ==null);
}
public int remove()
{
QueueNode temp = new QueueNode();
if (start ==null)
return -1;
else if (start.previous ==null)
{
temp = start;
start = null;
return temp.Position;
return temp.DocumentName;
return temp.Owner;
return temp.Size;
}
else
{
temp = start;
start = start.previous;
return temp.Position;
return temp.DocumentName;
return temp.Owner;
return temp.Size;
}
}
public void displayAll()
{
QueueNode temp = new QueueNode();
temp = start;
while (temp !=null)
{
System.out.println(temp.Po
System.out.println(temp.Do
System.out.println(temp.Ow
System.out.println(temp.Si
temp = temp.previous;
}
}
}
thanks for any help!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.