Advertisement
Kawsar_Hossain

UML104

Feb 22nd, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.35 KB | None | 0 0
  1.  
  2. public class LibraryItem {
  3.         protected String id;
  4.         protected String itemTittle;
  5.         public LibraryItem(String i,String it)
  6.         {
  7.             id=i;
  8.             itemTittle=it;
  9.         }
  10.         public void display(String au)
  11.         {
  12.             System.out.println("ID: "+id);
  13.             System.out.println("Item Tittle: "+itemTittle);
  14.             System.out.println("Author: "+au);
  15.            
  16.         }
  17. }
  18.  
  19.  
  20.  
  21. interface Information{
  22.     public void getTittle();
  23.     public void getbookID();
  24. }
  25.  
  26.  
  27. public class Book extends LibraryItem implements Information {
  28.     private String tittle;
  29.     private static String author;
  30.     private double bookID;
  31.    
  32.     public Book(String t,String a,double b)
  33.     {
  34.         super("ABD","11313");
  35.         tittle=t;
  36.         author=a;
  37.         bookID=b;
  38.     }
  39.    
  40.      public void getTittle()
  41.         {
  42.             System.out.println("Book Tittle: "+tittle);
  43.         }
  44.         public void getbookID()
  45.         {
  46.             System.out.println("Book ID: "+bookID);
  47.         }
  48.        
  49.     public static void main(String[] args) {
  50.         Book obj1 = new Book("Gaja KHao","Marzuk Rasel",190.5);
  51.         LibraryItem obj2 = new LibraryItem("ABD","11313");
  52.         obj1.getTittle();
  53.         obj1.getbookID();
  54.         obj2.display(author);
  55.        
  56.        
  57.        
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement