I need to make a class that records some information for a book. I need to make 2 constractors, the 1st one receives 6 "elements" and 2nd one only the first 5, as you can see in the code below. I also need to make a simple main program to check if it's working. I've been having errors though, I need help.
The class I made is the following:
public class LibraryRecord extends MainErgasia{
private String title;
private String writer;
private int Lnumber;
private String publisher;
private int year;
private boolean release;
public LibraryRecord(String title,String writer,int Lnumber,String publisher, int year, boolean release){
BookTitle = title;
BookWriter = writer;
LibraryNumber = Lnumber;
BookPublisher = publisher;
BookYear = year;
BookRelease = release;
}
public LibraryRecord (String title,String writer,int Lnumber,String publisher, int year){
BookTitle = title;
BookWriter = writer;
LibraryNumber = Lnumber;
BookPublisher = publisher;
BookYear = year;
BookReleased = released;
}
public String getTitle(){
return BookTitle;
}
public String getWriter(){
return BookWriter;
}
public int getLNumber(){
return LibraryNumber;
}
public String getPublisher(){
return BookPublisher;
}
public int getYear(){
return BookYear;
}
public void setReleased(boolean flag){
released = flag;
}
public boolean isReleased(){
return released;
}
public String toString(){
return BookWriter + "(#"+ LibraryNumber +")";
}
}
The main program is the following:
public class main extends Program{
LibraryRecord topBook = new LibraryRecord ("Hunger Games", "S.Collins",9780, "Press" , 2008,topBook.setReleased());
LibraryRecord topBook = new LibraryRecord ("Hunger games", "S.Collins",9780, "Press",2008);
LibraryRecord obj=topBook;
println(obj);
}