-2
import java.util.NoSuchElementException;
/**
* VolunteerLine Interface represents the interface for the VolunteerLine Class
* The class that uses this interface uses a Queue of Volunteers to simulate queuing and dequeuing volunteers to and from the
* VolunteerLine.
* @author khandan Monshi
*
*/
public interface VolunteerLineInterface {
/**
* adds a new Volunteer to the volunteer line Queue
* @param v A Volunteer object
* @return true if volunteer is queued successfully , false if queue is full
*/
public boolean addNewVoluneer(Volunteer v);
/**
* removes volunteer from the volunteer queue line
* @return Volunteer Object
* @throws NoSuchElementException if queue is empty
*/
public Volunteer volunteerTurn() throws NoSuchElementException;
/**
* checks if there are volunteers in line
* @return true if volunteer line is empty, true otherwise
*/
public boolean volunteerLineEmpty();
/**
* Returns an array of the Volunteers in the queue
* @return an array of the volunteers in the queue
*/
public Volunteer[] toArrayVolunteer();
}
import java.util.NoSuchElementException;
public class VolunteerLine implements VolunteerLineInterface{
@Override
public boolean addNewVoluneer(Volunteer v) {
// TODO Auto-generated method stub
return false;
}
@Override
public Volunteer volunteerTurn() throws NoSuchElementException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean volunteerLineEmpty() {
// TODO Auto-generated method stub
return false;
}
@Override
public Volunteer[] toArrayVolunteer() {
// TODO Auto-generated method stub
}
}
我不是这个做的是,我还有其他的错误,我需要解决,但我遇到的问题是我不断收到一个错误说:“类型VolunteerLine必须实现继承的抽象方法VolunteerLineInterface.addNewVoluneer(志愿者)”即使我明确已经实施。我在VolunteerLine上有一个错误,当我将鼠标悬停在它上面并单击添加未实现的方法时,它仍然显示出相同的错误。有什么我做错了吗?口口声声说我必须添加未实现的方法
尝试修复其他错误并回到此处。你可能只需要一个干净的构建。 – shmosel
我注意到您的方法名称有一个错字:addNewVoluneer(丢失字母't') –
对我来说编译得很好。 –