The assignment is to create a program that holds a collection of items (the items are different types of texts, such as books, journals etc). you need to be able to add new items, delete them and list items in the collection. It needs a text based ui as well.
I've started trying to create each of the items which can all be based on a super class so i've tried to create that
public abstract class Item
{
private String author;
private int pubYear;
private String titleOfPub;
/**
* requires : author != null
* modifies : this
* effects : sets author, pub year,and titleOfPub
* @param author the item's author, year the items publication year, title the item's title
*/
public Item(String author, int year, String title)
{
this.author = author;
pubYear = year;
titleOfPub = title;
}
public String getAuthor()
{
return author;
}
this would be my base class but I really dont know what methods to put into it. From this i've tried to make one sub class but not sure if its right.
public class Book extends Item
{
// instance variables - replace the example below with your own
private String placeOfPub;
private String publisher;
private int edition;
/**
* Constructor for objects of class Book
*/
public Book(String author, int year, String title, String place, String publisher, int edition)
{
this.author = author;
pubYear = year;
titleOfPub = title;
placeOfPub = place;
publisher = publisher;
edition = edition;
}
}
I know asking for help like this is frowned upon but im really running out of options. I just need help in finding what goes where
Thanks in advance

New Topic/Question
Reply



MultiQuote





|