2017-02-13 38 views
-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上有一个错误,当我将鼠标悬停在它上面并单击添加未实现的方法时,它仍然显示出相同的错误。有什么我做错了吗?口口声声说我必须添加未实现的方法

+2

尝试修复其他错误并回到此处。你可能只需要一个干净的构建。 – shmosel

+3

我注意到您的方法名称有一个错字:addNewVoluneer(丢失字母't') –

+0

对我来说编译得很好。 –

回答

2

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

相关问题