
Untitled
By: a guest on
May 7th, 2012 | syntax:
Java | size: 1.28 KB | hits: 16 | expires: Never
class Book
{
// The fields.
private String author;
private String title;
private int pages;
private String refNumber;
/**
* Set the author and title fields when this object
* is constructed.
*/
public Book(String bookAuthor, String bookTitle, int amountPages, String setRef)
{
refNumber = setRef;
author = bookAuthor;
title = bookTitle;
pages = amountPages;
}
public Book(String bookAuthor, String bookTitle, int amountPages)
{
refNumber = "";
author = bookAuthor;
title = bookTitle;
pages = amountPages;
}
public String returnAuthor()
{
return author;
}
public int getPages()
{
return pages;
}
public String returnTitle()
{
return title;
}
public void printAuthor()
{
System.out.println(author);
}
public void printTitle()
{
System.out.println(title);
}
public void printDetails()
{
System.out.println("Titel : " + title);
System.out.println("Auteur : " + author);
System.out.println("Aantal pagina's : " + pages);