/** * 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 { // The fields. private String author; private String title; private int price; /** * Set the author and title fields when this object * is constructed. */ public Book(String author, String title, int price) { this.author = author; this.title = title; this.price = price; } /** * This method set a new price * @param nyPris */ public void setPrice(int nyPris) { price = nyPris; } /** * This method prints all the information abouta book */ public void writeBook() { System.out.println("Title :" + title); System.out.println("Author :" + author); System.out.println("Price :" + price); } /** * This method returns the price of a book * @return the price */ public int getPrice() { return price; } }