Java Reference
In-Depth Information
System.out.println(“Getting the title: “ + title);
return title;
}
public void setLength(int seconds)
{
System.out.println(“Setting the length to “ + seconds);
length = seconds;
}
public int getLength()
{
System.out.println(“Getting the length: “ + length);
return length;
}
public void setCustomerName(String s)
{
System.out.println(“Setting customer name to “ + s);
customer = s;
}
public boolean isRented()
{
return rented;
}
public void rentMovie()
{
if(customer.equals(“”))
{
System.out.println(“Customer name needs to be set”);
}
else if(rented)
{
System.out.println(title + “ is rented”);
}
else
{
System.out.println(“Renting “ + title + “ to “
+ customer);
rented = true;
}
}
public void returnMovie()
{
System.out.println(“Returning “ + title);
rented = false;
customer = “”;
}
}
Search WWH ::




Custom Search