Hello everyone.
I am kinda a beginner, been java programming for 3-4 months, but i learn fast.
I have a java programming project, a gui library system, something complex.
User has to create library, then add books, delete books, add chapters in book, remove chapter.
First i have to do 6 classes( architecture, they name it):
- class Library: contains objects of type Book and implements ILibrary
- class Book: contains objects of type Chapter and book name and implements IBook
- class Chapter: contains objects of type Paragraph and chapter name si and implements IChapter
- class Sentence: extends ArrayList<String> and retain one sentence
- class Paragraph: extends Body<Sentence> and retain one or more sentences, so a paragraph
- class Body: implements Collection and can retain only objects of the same type in a ArrayList
I did 3 classes for this 6. But i stuck at class Body, i did not learn about parameterized class, so i don't know how to declare it. Can someone help me with Body class and Paragraph class?
Especially i stuck at build constructors. I don't know what to do with the <E> from Body
package element; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; public class Body<E> implements Collection { private E item; private ArrayList<E> items = new ArrayList<E>(); @Override public int size() { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean isEmpty() { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean contains(Object o) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Iterator iterator() { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object[] toArray() { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object[] toArray(Object[] a) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean add(Object e) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean remove(Object o) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean containsAll(Collection c) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean addAll(Collection c) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean removeAll(Collection c) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean retainAll(Collection c) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void clear() { throw new UnsupportedOperationException("Not supported yet."); } }
I'm a still a student and a beginner in java, so please bear with me.
Ignore javadoc becouse is in romanian(my language