继续说我必须添加未实现的方法

时间:2017-02-13 06:18:16

标签: java

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(Volunteer )“即使我清楚地实现了它。我在VolunteerLine上有一个错误,当我将鼠标悬停在它上面并单击添加未实现的方法时,它仍显示出相同的错误。有什么东西我做错了吗?

1 个答案:

答案 0 :(得分:2)

修复其他编译错误并执行干净的构建。您发布的抽象方法的实现很好。