why when i add private int yearpublished; my program has an error what is my mistake can you please help to fix it
------------------------------------------------------
this is the error that came out
C:\goh>javac libmainsys.java
libmainsys.java:19: ';' expected
yearpublished = yrpub
^
libmainsys.java:28: cannot resolve symbol
symbol : variable yearpublish
location: class libary
System.out.print(", Year Published: " + yearpublish);
^
libmainsys.java:87: insert(java.lang.String,java.lang.String,java.lang.String,in
t,int) in ArrayInOb cannot be applied to (java.lang.String,java.lang.String,java
.lang.String,java.lang.String,int)
arr.insert("Java_how__to_program", "Patty_John", "Deitel", "201", 2002);
^
libmainsys.java:88: insert(java.lang.String,java.lang.String,java.lang.String,in
t,int) in ArrayInOb cannot be applied to (java.lang.String,java.lang.String,java
.lang.String,java.lang.String,int)
arr.insert("System_Design", "Dexter_Smith", "Thomson", "202", 2000);
^
libmainsys.java:89: insert(java.lang.String,java.lang.String,java.lang.String,in
t,int) in ArrayInOb cannot be applied to (java.lang.String,java.lang.String,java
.lang.String,java.lang.String,int)
arr.insert("Program_Design", "Lorraine_Paul", "About", "199", 1996);
^
libmainsys.java:90: insert(java.lang.String,java.lang.String,java.lang.String,in
t,int) in ArrayInOb cannot be applied to (java.lang.String,java.lang.String,java
.lang.String,java.lang.String,int)
arr.insert("Computer_Architecture", "Paul_Andrew","Dzone", "206", 1990);
^
libmainsys.java:91: insert(java.lang.String,java.lang.String,java.lang.String,in
t,int) in ArrayInOb cannot be applied to (java.lang.String,java.lang.String,java
.lang.String,java.lang.String,int)
arr.insert("Visual_Basic_How_To_ Program", "Tom_Jones", "Jeffereson_publicati
on", "207", 2007);
^
libmainsys.java:92: insert(java.lang.String,java.lang.String,java.lang.String,in
t,int) in ArrayInOb cannot be applied to (java.lang.String,java.lang.String,java
.lang.String,java.lang.String,int)
arr.insert("Information_ Management", "William_Peter", "Mcgraw_Hill", "195",
2004);
^
libmainsys.java:93: insert(java.lang.String,java.lang.String,java.lang.String,in
t,int) in ArrayInOb cannot be applied to (java.lang.String,java.lang.String,java
.lang.String,java.lang.String,int)
arr.insert("Sofware_ Application", "Henry_Sam", "Pearson", "296", 2002);
^
libmainsys.java:94: insert(java.lang.String,java.lang.String,java.lang.String,in
t,int) in ArrayInOb cannot be applied to (java.lang.String,java.lang.String,java
.lang.String,java.lang.String,int)
arr.insert("English", "Samantha_Julia", "James_Hill", "394", 2001);
^
libmainsys.java:95: insert(java.lang.String,java.lang.String,java.lang.String,in
t,int) in ArrayInOb cannot be applied to (java.lang.String,java.lang.String,java
.lang.String,java.lang.String,int)
arr.insert("Web_Publishing", "Audrey_Cynthia", "Surg", "193", 2001);
^
libmainsys.java:96: insert(java.lang.String,java.lang.String,java.lang.String,in
t,int) in ArrayInOb cannot be applied to (java.lang.String,java.lang.String,java
.lang.String,java.lang.String,int)
arr.insert("Human_Computer_Interaction", "Tony_Edward", "Telde", "202", 1998
);
----------------------------------------------------------------------------
// to run this program: C>java libmainsys
///////////////////////////////////////////////////////
/////////
class libary
{
private String booktitle;
private String bookauthor;
private String publisher;
private int yearpublished;
private int nofcop;
//-----------------------------------------------------
------
public libary(String title, String author, String
pub, int yrpub, int nfcp)
{ // constructor
booktitle = title;
bookauthor = author;
publisher = pub;
yearpublished = yrpub
nofcop = nfcp;
}
//-----------------------------------------------------
------
public void displaylibary()
{
System.out.print(" Book Title: " + booktitle);
System.out.print(", Book Author: " + bookauthor);
System.out.print(", Book Publisher: " + publisher);
System.out.print(", Year Published: " +
yearpublish);
System.out.println(",No Of Copies : " + nofcop);
}
//-----------------------------------------------------
------
public String getLast() // get title
{ return booktitle; }
} // end class libary
///////////////////////////////////////////////////////
/////////
class ArrayInOb
{
private libary[] nfcp; // ref to array ypub
private int nElems; // number of data items
//-----------------------------------------------------
---------
public ArrayInOb(int max) // constructor
{
nfcp = new libary[max]; // create the array
nElems = 0; // no items yet
}
//-----------------------------------------------------
---------
// put libary into array
public void insert(String title, String author,
String pub, int yrpub, int nofcop)
{
nfcp[nElems] = new libary(title, author, pub, yrpub,
nofcop);
nElems++; // increment size
}
//-----------------------------------------------------
---------
public void display() // displays array
contents
{
for(int j=0; j<nElems; j++) // for each element,
nfcp[j].displaylibary(); // display it
System.out.println("");
}
//-----------------------------------------------------
---------
public void bubbleSort()
{
int i, j;
libary temp;
for (i = nElems-1; i >= 0; i--)
for (j = 1; j <= i; j++)
if
(nfcp[j-1].getLast().compareTo(nfcp[j].getLast())>0)
{
temp = nfcp[j-1];
nfcp[j-1] = nfcp[j];
nfcp[j] = temp;
}
}
//-----------------------------------------------------
---------
} // end class ArrayInOb
///////////////////////////////////////////////////////
/////////
class libmainsys
{
public static void main(String[] args)
{
int maxSize = 1000; // array size
ArrayInOb arr; // reference to array
arr = new ArrayInOb(maxSize); // create the array
arr.insert("Java_how__to_program", "Patty_John",
"Deitel", "201", 2002);
arr.insert("System_Design", "Dexter_Smith",
"Thomson", "202", 2000);
arr.insert("Program_Design", "Lorraine_Paul",
"About", "199", 1996);
arr.insert("Computer_Architecture",
"Paul_Andrew","Dzone", "206", 1990);
arr.insert("Visual_Basic_How_To_ Program",
"Tom_Jones", "Jeffereson_publication", "207", 2007);
arr.insert("Information_ Management",
"William_Peter", "Mcgraw_Hill", "195", 2004);
arr.insert("Sofware_ Application", "Henry_Sam",
"Pearson", "296", 2002);
arr.insert("English", "Samantha_Julia",
"James_Hill", "394", 2001);
arr.insert("Web_Publishing", "Audrey_Cynthia",
"Surg", "193", 2001);
arr.insert("Human_Computer_Interaction",
"Tony_Edward", "Telde", "202", 1998);
System.out.println("Before sorting:");
arr.display(); // display items
arr.bubbleSort(); // insertion-sort them
System.out.println("After sorting:");
arr.display(); // display them again
} // end main()
} // end class libmainsys