|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectWriteVertical
public class WriteVertical
The WriteVertical Java application illustrates recursive
methods that write the digits of a number vertically.
| Constructor Summary | |
|---|---|
WriteVertical()
|
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
The main method prompts the user for a number that is then printed in two different ways using recursive methods. |
static boolean |
query(java.util.Scanner input,
java.lang.String prompt)
|
static void |
superWriteVertical(int number)
Print the digits of an integer vertically. |
static void |
writeVertical(int number)
Print the digits of a non-negative integer vertically. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WriteVertical()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
String
argument (args) is not used in this implementation.
public static boolean query(java.util.Scanner input,
java.lang.String prompt)
public static void writeVertical(int number)
number - the number to be printed
n >= 0. The method does not check the precondition, but
the behavior is wrong for negative numbers.
number have been written, stacked vertically.public static void superWriteVertical(int number)
number - the number to be printed
number have been written, stacked vertically.
If number is negative, then a negative sign appears on top.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||