|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IMeter
Objects implementing IMeter are used to measure the volume of fuel delivered to a customer at a gas pump. Such objects also know the current cost per unit (liter or gallon) of fuel and can thus calculate the cost of the fuel delivered. For informational purposes, they also know the octane level of the fuel and a marketing label such as "Gold" or "Ultra".
A typical gas pump will have three objects implementing IMeter
,
one for each of the three different kinds of fuel available.
Please see the package description for a more in-depth discussion of using this class.
Method Summary | |
---|---|
void |
addView(IView aView)
Add a view (graphical user interface) to the meter. |
double |
calcTotalCost()
Calculate the total cost of fuel sold to this customer. |
String |
getLabel()
Get the label for this meter's fuel. |
int |
getOctane()
Get the octane rating of the fuel. |
double |
getUnitCost()
Get the cost per unit of fuel. |
double |
getVolumeSold()
Get the volume of fuel sold to this customer. |
void |
pump(double howMuch)
Pump some fuel into a tank. |
void |
reset()
Reset the meter for a new customer. |
Method Detail |
---|
double getUnitCost()
double getVolumeSold()
int getOctane()
String getLabel()
void reset()
void pump(double howMuch)
howMuch
- How much fuel was pumped since the last time this
method was called.double calcTotalCost()
void addView(IView aView)
updateView
method must be called each time the meter's state changes.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |