This is the last part of my program, i am fairly new to java as this is my second project. I am not exactly sure how to set the limits for the class and how to go about doing this. Anything that would help me understand nd get started would be appreciated.
Create a book class that has number of pages (between 32 and 1,200), and a retail price (between 3.95 and 120.00). The other methods allow changing the price (with the same limits) and returning the average price per page.
here is code so far:
public class Book
{
// instance variables - replace the example below with your own
private double retailPrice;
private int pages;
/**
* Constructor for objects of class Book
*/
public Book()
{
// initialise instance variables
}
/**
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public boolean setData(int pages, double retailPrice)
{
// put your code here
return true;
}
/**
*
*/
public double getPrice()
{
return retailPrice;
}
/**
*
*/
public double getPricePerPage()
{
double temp = retailPrice/pages;
return temp;
}
/**
*
*/
public boolean changePrice(double retailPrice)
{
return true;
}