/* * @topic T11325 Interface Demo * @brief class Book extends Product implements Printable */ package pckg; public class Book extends Product implements Printable { public static void main (String[] args ) { Book first = new Book( "12345", "Irish stories and legends", 14.50, "folklore" ); Book second = new Book( first ); first.print(); second.print(); } private String author; // Constructor public Book( String code, String description, double price, String author ) { super( code, description, price ); this.author = author; } // Copy constructor. public Book( Book another ) { this( another.code, another.description, another.price, another.author ); } // implement the Printable interface @Override public void print() { System.out.println( "Code: " + code); System.out.println( "Description: " + description); System.out.println( "Price: " + price); System.out.println( "Autor: " + author); } }//class Book