Format CLASS SPECIFICATIONS

 

These classes are not part of Java but are available through the library named apcslib.  You must have the file apcslib.jar in the appropriate directory where Java can access it.  To have these classes available in your program, use this command:

import apcslib.*;

Other features of apcslib will be covered in later lessons.

 

 

Format

 

 

<<constructors>>

...

 

<<accessors>>

public static String center(double d,

                            int fWidth,

                            int dPlaces)

public static String center(long l, int fWidth)

public static String center(String s, int fWidth)

public static String left(double d,

                            int fWidth,

                            int dPlaces)

public static String left(long l, int fWidth)

public static String left(String s, int fWidth)

public static String right(double d,

                            int fWidth,

                            int dPlaces)

public static String right(long l, int fWidth)

public static String right(String s, int fWidth)

 

<<modifiers>>

...

 

 

 

Accessor Methods

public static String center(double d, int fWidth, int dPlaces)

postcondition

returns a String representing the double d centered in a field of fWidth rounded to dPlaces.

 

public static String center(long l, int fWidth)

postcondition

returns a String representing the long l centered in a field of fWidth.

 

public static String center(String s, int fWidth)

postcondition

returns a String representing the String s centered in a field of fWidth.

 

public static String left(double d, int fWidth, int dPlaces)

postcondition

returns a String representing the double d adjusted to the left in a field of fWidth rounded to dPlaces.

 

public static String left long l, int fWidth)

postcondition

returns a String representing the long l adjusted to the left in a field of fWidth.

 

public static String left(String s, int fWidth)

postcondition

returns a String representing the String s adjusted to the left in a field of fWidth.

 

public static String right(double d, int fWidth, int dPlaces)

postcondition

returns a String representing the double d adjusted to the right in a field of fWidth rounded to dPlaces.

 

public static String right(long l, int fWidth)

postcondition

returns a String representing the long l adjusted to the right in a field of fWidth.

 

public static String right(String s, int fWidth)

postcondition

returns a String representing the String s adjusted to the right in a field of fWidth.