/**
* A Spooter is a special type of Flubber (in the Doodad category)
*
* @author Loren Segal
* @version 1.0
*/
public class Spooter extends Flubber implements Locomote
{
//=== Default and markup price values ===//
private static final double PRICE_DEFAULT = 9.99;
private static final double PRICE_EXTRA = 4.25;
//=== Locomote interface ===//
private static final String MOVE_TYPE = "Run";
/**
* Part of the Locomote interface; returns the move type of the Spooter
*
* @return Currently returns "Run"
*/
public String style()
{
return MOVE_TYPE;
}
//=== End Locomote Interface ===//
/**
* Calculates the price based on the price markup (currently 4.25).
* Will return a default price value (currently 9.99) if this
* marked up price is greater than 100
*
* @return Marked up price value
*/
public double calculatePrice()
{
double price = super.calculatePrice() + PRICE_EXTRA;
if (price > 100)
{
return PRICE_DEFAULT;
}
else
{
return price;
}
}
//=== Constructors ===//
/**
* Creates a Spooter with a name and minimum age.
*
* @param name Name of the Spooter.
* @param minAge minimum age restriction.
*/
public Spooter(String name, int minAge)
{
super(name, minAge);
}
//=== End Constructors ===//
} Powered by
GeSHi Syntax Highlighting software.
Author of all (other) material unless otherwise specified:
Loren Segal. Copyright 2005.