1 USING THE FOLLOWING CLIENT CLASS WRITE THE CLASS BOOK publ

1. USING THE 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

import java.util.*;
import java.lang.String;
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();
}

}

// creating Book class
class Book {
   // this instance variable is visible for any child class.
   public String Bookname;
   public String AuthorName;
   public String bookId;
   //The variable are assigned in the constructor.
   public Book(String name,String Author, String Id){
       Bookname = name;
       AuthorName=Author;
       bookId=Id;
   }
   // This display() method prints the Book details
   public void display(){
       System.out.println(\"\ Book Details are:\\t\");
       System.out.println(\"Book Name: \"+Bookname);
       System.out.println(\"AuthorName: \"+AuthorName);
       System.out.println(\"BookId: \"+bookId);
   }
  
}

***************** output**********************


Book Details are:
Book Name: Harry Potter and the Goblet of Fire
AuthorName: J. K. Rowling
BookId: 074666

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

1. USING THE 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