I am getting a bunch of errors after compiles this code... Mostly is invalid declarations and return values errors. There is also one inconvertible type
I can't figure out what's wrong...
This is the guideline of the class file
Class Store should have two instance variables name and items, of type String and List respectively. It should provide methods addItem(StoreItem anItem) and removeItem(StoreItem anItem) to add and remove items from the store. Additionally, it should implement methods audioVideoItems() and photoItems() to return an Iterator for the available audio-video, and photo items along with the method authors() to return an iterator for all authors whose work is available through the store.Here is my code
Code:
import java.util.*;
public class Store
{
private String[] name;
private List items = new Vector();
public addItem(StoreItem anItem)
{
items.add(anItem);
}
public removeItem(StoreItem anItem)
{
items.remove(anItem);
}
public audioVideoItems()
{
Iterator name = items.iterator();
while(name.hasNext())
{
String aString = (String)name.next();
return name;
}
}
public photoItems()
{
Iterator name = items.iterator();
while(name.hasNext())
{
String aString = (String)name.next();
return name;
}
}
public authors()
{
Iterator name = items.iterator();
while(name.hasNext())
{
String aString = (String)name.next();
return name;
}
}
public String getName()
{
return (String)name;
}
public List getItems()
{
return items;
}
Store(String[] aName, List anItem)
{
name = aName;
items = anItem;
}
public String toString()
{
return ("");
}
}