/** * A class that maintains information on a book. * This might form part of a larger application such * as a library system, for instance. * * @author Hallgeir * @version 1, 2014 */ class Book extends Produkt { // The fields. public String author; private static int numberOfBooks = 0; /** * Set the author and title fields when this object * is constructed. * @param author name on author * */ public Book(String author, String title, int price) { super(title, price); this.author = author; numberOfBooks++; } /** * This method prints all the information abouta book */ public void printDescription() { // System.out.println("Title :" + title); System.out.println("Author :" + author); // System.out.println("Price :" + price); System.out.println(""); } /** * This method returns the number of books (+) * @return numberOfBooks * Hallgeir: What about cohesion? */ public int getNumberOfBooks() { // Hallgeir: What about cohesion here? System.out.println ("Number of Books is " + numberOfBooks); return numberOfBooks; } public String getProduktType() { return "Book"; } }