|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Customer
CS 537, Fall 2002, Project 3. An energy customer.
Copyright © 2002 by Marvin Solomon. All rights reserved.
Field Summary | |
private int[] |
consumed
Total consumed thus far |
private static DecimalFormat |
fmt
A format for printing fractions to two decimal places. |
private int |
id
Id of this customer |
private int[] |
maxPurchase
Mean amount of each quantity to purchase on each request. |
private int |
meanSleepTime
Mean sleep time (in milliseconds) between purchase requests. |
private int |
numberOfPurchases
Number of buying requests completed by this Consumer |
private Random |
rand
A source of random numbers. |
private int |
totalServiceTime
Sum of service times for all requests |
private Trader |
trader
The trader to buy from. |
Fields inherited from interface Enron |
cname, COAL, COMMODITIES, cunit, ELEC, GAS, OIL |
Constructor Summary | |
Customer(int id,
Trader trader)
Create a new Customer object. |
Method Summary | |
private static void |
pl(Object o)
Abbreviation for System.out.println. |
void |
printReport()
Print information about the history of this customer. |
void |
run()
Main loop. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int id
private Trader trader
private int meanSleepTime
private int[] maxPurchase
private int[] consumed
private int numberOfPurchases
private int totalServiceTime
private Random rand
private static DecimalFormat fmt
Constructor Detail |
public Customer(int id, Trader trader)
id
- the unique id of this customer.trader
- the trader to contact to buy stuff.Method Detail |
private static void pl(Object o)
o
- the object to be printed.public void printReport()
public void run()
run
in interface Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |