Add accessor and mutator methods to the Book class created in question #13.
What will be an ideal response?
```
/** Class for a book with title, author, ISBN and year published.
Class invariant: A Book always has a title and author.
*/
public class Book
{
/** Instance variables */
private String title;
private String author;
private String ISBN;
private int yearPublished;
/** Accessor methods */
public String getTitle()
{
return title;
}
public String getAuthor()
{
return author;
}
public String getISBN()
{
return ISBN;
}
public int getYearPublished()
{
return yearPublished;
}
/** Mutator methods */
public void setISBN(String isbn)
{
ISBN = isbn;
}
public void setYearPublished(int y)
{
yearPublished = y;
}
/** Facilitator methods */
public String toString()
{
return (title + " " + author + " " + ISBN + " " + yearPublished);
}
public boolean equals(Book otherBook)
{
if(otherBook == null)
return false;
else
return (title.equals(otherBook.title) &&
author.equals(otherBook.author)
&& ISBN.equals(otherBook.ISBN) &&
yearPublished == otherBook.yearPublished);
}
}
```
You might also like to view...
What is IaaS?
A) Internet as a service, the ability to use compute workloads via the Internet B) Infrastructure as a service, the ability to run virtual machines on hardware provided in the cloud C) Infrastructure as a solution, the ability to run virtual machines on hardware provided in the cloud D) Image architecture action systems, the ability to copy computers that perform actions in a closed network
There are ________ bullet buttons available on the Home tab
Fill in the blank(s) with correct word
Which feature monitors your computer for signs of spyware infection and blocks actions of malicious programs?
a. Windows Defender b. Windows Firewall c. Action Center d. Secure Startup
Which of the following is an example of course-grained access control?
A. Employees can open the door. B. Employees based in the US can open or close the door during office hours. C. Employees in the Engineering department and based in the US can open or close the door during office hours if they are assigned to an active project. D. Employees with passwords can open the door.