Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

using Java Question 3: (practice to write the code for accessor methods, method

ID: 3851685 • Letter: U

Question

using Java


Question 3: (practice to write the code for accessor methods, method toString and UM The class TheBook holds the title, bookld, ISBN, writer, publisher. Write the code for this class TheBook for: a. 4 above private data members b. No-argument constructor and parameter constructor C4 Accessor methods that return value of each data member d. 4 Mutator methods that set new value of each data member e Method toString that returns the output string if "Data Structures and Algorithms Using Java" is title "DATA1234" is book id, "978-0-7637-5756-4" is ISBN, "William McAllister is writer and Johns and Bartlett Publisher" is publisher the output as follows: Book Title: Data Structures and Algorithms Using Java Book ID:DATA1234 Book ISBN: 978-0-7637-5756-4 Writer: William McAllister Publisher: Johns and Bartlett Publishers f Draw UML of class TheBook Question 4: toractice how to analvze a requirement to.come un the desien with data tvne class)

Explanation / Answer


public class TheBook {

//private data members
private String title;
private String bookId;
private String ISBN
private String writer;
private String publisher;


public TheBook(){}


public TheBook(String title, String bookId, String ISBN, String writer, String publisher) {
  this.title = title;
  this.bookId = bookId;
  this.ISBN = ISBN;
  this.writer = writer;
  this.publisher = publisher;
}

public String getTitle() {
  return title;
}
public void setTitle(String title) {
  this.title = title;
}


public String getbookId() {
  return bookId;
}
    public void setbookId(String bookId) {
  this.bookId = bookId;
}


public String getISBN() {
  return ISBN;
}
    public void setISBN(String bookId) {
  this.ISBN = ISBN;
}



public String getwriter() {
  return writer;
}
public void setwriter(String writer) {
  this.writer = writer;
}


public String getPublisher() {
  return publisher;
}
    public void setPublisher(String publisher) {
  this.publisher = publisher;
}







/**
* Returns String description of TheBook.
*/
public String toString() {
  String description = "";
  description += "Book Title: " + title + " ";
  description += "Book ID: " + bookId + " ";
  description += "Book ISBN: " + ISBN + " ";
  description += "Writer: " + Writer + " ";
  description += "publisher: " + publisher + " ";
  return description;
}

}