|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectCarWash
public class CarWash
The CarWash Java application illustrates the use of
the carWashSimulate method.
The illustration uses the following values:
washTime = 240
arrivalTime = 0.0025
totalTime = 6000
| Constructor Summary | |
|---|---|
CarWash()
|
|
| Method Summary | |
|---|---|
static void |
carWashSimulate(int washTime,
double arrivalProb,
int totalTime)
Simulate the running of a car washer for a specified amount of time. |
static void |
main(java.lang.String[] args)
The main method activates carWashSimulate with the values:
The String argument (args) is not used in
this implementation. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CarWash()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
carWashSimulate with the values:
washTime = 240
arrivalTime = 0.0025
totalTime = 6000
String argument (args) is not used in
this implementation.
public static void carWashSimulate(int washTime,
double arrivalProb,
int totalTime)
washTime - the number of seconds required to wash one cararrivalProb - the probability of a customer arriving in any second, for example
0.1 is 10%totalTime - the total number of seconds for the simulation
washTime and totalTime are positive;
arrivalProb lies in the range 0 to 1.
washTime is the
number of seconds needed to wash one car, arrivalProb is
the probability of a customer arriving in any second, and
totalTime is the total number of seconds for the
simulation. Before the simulation, the method has written its three
parameters to System.out. After the simulation, the method
has written two pieces of information to System.out:
(1) The number of cars washed, and (2) The average waiting time for
customers that had their cars washed. (Customers that are still in the
queue are not included in this average).
java.lang.IllegalArgumentException - Indicates that one of the arguments violates the precondition.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||