Question: Don't really understand javadoc comments, never written them before. Need help writing them at the different makrked spots in the program. public class Bibliography {

Don't really understand javadoc comments, never written them before. Need help writing them at the different makrked spots in the program.

public class Bibliography {

//

private Publication[] publications;

private int last;

public Bibliography() {

//

publications = new Publication[10];

last = 0;

}

private void resize() {

//

Publication[] publicationsNew = new Publication[2 * publications.length];

System.arraycopy( publicationsNew, 0, publications, 0,

publications.length );

this.publications = publicationsNew;

}

public boolean add( Publication pub ) {

//

if ( pub.canAdd() ) {

if ( last == publications.length ) {

resize();

}

publications[last] = pub;

last++;

return true;

} else

return false;

}

public int capacity() {

//

return publications.length;

}

public boolean deleteLast() {

//

last--;

return true;

}

public Publication get( int c ) {

//

if ( c < last )

return publications[c];

return null;

}

public int size() {

//

return last;

}

}

*********************************************************************

public class Publication {

private String author;

private String title;

private String city;

private String publisher;

private int year;

public Publication( String author, String title, String city,

String publisher, int year ) {

this.author = author;

this.title = title;

this.city = city;

this.publisher = publisher;

this.year = year;

}

public boolean canAdd() {

if (( author != null && author.length() > 0 )

&& ( title != null && title.length() > 0 )

&& ( year >= 1450 && year <= 2018 && year != 0 )) {

return true;

}

return false;

}

public String getAuthor() {

return author;

}

public String getCity() {

return city;

}

public String getPublisher() {

return publisher;

}

public String getTitle() {

return title;

}

public int getYear() {

return year;

}

public boolean setAuthor( String author ) {

if ( author != null && author.length() > 0 ) {

this.author = author;

return true;

} else {

this.author = "";

return false;

}

}

public void setCity( String city ) {

if (city != null) {

this.city = city;

} else {

this.city = "";

}

}

public void setPublisher( String publisher ) {

if (publisher != null) {

this.publisher = publisher;

} else {

this.publisher = "";

}

}

public boolean setTitle( String title ) {

if (title != null && title.length() > 0) {

this.title = title;

return true;

} else {

this.title = "";

return false;

}

}

public boolean setYear( int year ) {

if (year >= 1450 && year <= 2018 && year != 0) {

this.year = year;

return true;

} else

return false;

}

@Override

public String toString() {

return "Publication [ author=" + author + ", title=" + title + ", city="

+ city + ", publisher=" + publisher + ", year=" + year + " ]";

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!