Using th following client class write the class book Public

Using th following client class write the class book. Public class bookclient {public static void main (string [] args) {book b = new book (\"harry potter and the goblet of fire\", \"J. K. Rowling\", \"074666\"); b.display();}}

Solution

BookClient.java


public class BookClient {

  
   public static void main(String[] args) {
       Book b = new Book(\"Harry potter and the Goblet of Fire\", \"J. K. Rowling\",074666);
       b.display();
   }

}

Book.java

public class Book {
   private String title;
   private String author;
   private int isbn;
   Book(String title, String author, int isbn){
       this.title = title;
       this.author = author;
       this.isbn = isbn;
   }
   public String getTitle() {
       return title;
   }

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

   public String getAuthor() {
       return author;
   }

   public void setAuthor(String author) {
       this.author = author;
   }

   public int getIsbn() {
       return isbn;
   }

   public void setIsbn(int isbn) {
       this.isbn = isbn;
   }

   public void display(){
       System.out.println(\"Title : \"+title+\"\ Author : \"+author+\"\ ISBN : \"+isbn);
   }
}

Output:

Title : Harry potter and the Goblet of Fire
Author : J. K. Rowling
ISBN : 31158

 Using th following client class write the class book. Public class bookclient {public static void main (string [] args) {book b = new book (\
 Using th following client class write the class book. Public class bookclient {public static void main (string [] args) {book b = new book (\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site