// Arup Guha
// 3/22/06
// A solution to COP 3330 in-class exercise on 3/21/06. This class inherits
// from MediaItem and defines a simple Book object.

import java.util.*;

public class Book extends MediaItem {

  // These are the extra instance variables for a Book object.
  private int numpages;
  private String title;
  
  // Initializes a Book object with values of the appropriate parameters.
  public Book(String author, String thetitle, int idnum, double price, int pages) {
    super(price, idnum, author);
    title = thetitle;
    numpages = pages;
  }  

  // Returns a string that represents a Book object in a readable format.
  public String toString() {
    return ("Author: "+author+" Title: "+title+" Sku: "+sku+" Cost: "+price+" Number of Pages = "+numpages);
  }

  // This method creates a paperback version of a book, which is the same 
  // as the original except it costs 70% as much and its sku number is the
  // original's sku with a 0 added to the end.
  public Book makePaperback() {
    return new Book(author, title, sku*10, price*.7, numpages);
  }

  // Returns a clone of the current object.
  public Book clone() {
    return new Book(author, title, sku, price, numpages);
  }

}
