Class Traffic
java.lang.Object
Traffic
public class Traffic
- extends java.lang.Object
|
Method Summary |
static void |
main(java.lang.String[] args)
|
static void |
printNumber(double d,
int minimumWidth,
int fractionDigits)
Print a number to System.out, using a specified format. |
double |
simlights(int offset,
int span,
double arrivalProb,
int travelTime,
int totalTime)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Traffic
public Traffic()
main
public static void main(java.lang.String[] args)
simlights
public double simlights(int offset,
int span,
double arrivalProb,
int travelTime,
int totalTime)
printNumber
public static void printNumber(double d,
int minimumWidth,
int fractionDigits)
- Print a number to System.out, using a specified format.
- Parameters:
d - the number to be printedminimumWidth - the minimum number of characters in the entire outputfractionDigits - the number of digits to print on the right side of the decimal point
- Precondition:
-
fractionDigits is not negative.
- Postcondition:
-
The number
d has been printed to System.out.
This printed number is rounded to the specified number of digits on the
right of the decimal. If fractionDigits is 0, then only the
integer part of d is printed. If necessary, spaces appear
at the front of the number to raise the total number of printed
characters to the minimum. Additional formatting details are obtained
from the current locale. For example, in the United States, a period is
used for the decimal and commas are used to separate groups of
integer digits.
- Throws:
IllegalArgumentException - Indicates that fractionDigits is negative.
- Example:
-
printNumber(12345.27, 8, 1);
Prints 12,345.3 in the U.S.