Class WriteVertical

java.lang.Object
  extended by WriteVertical

public class WriteVertical
extends java.lang.Object

The WriteVertical Java application illustrates recursive methods that write the digits of a number vertically.

Java Source Code for this class:
http://www.cs.colorado.edu/~main/applications/WriteVertical.java


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

WriteVertical

public WriteVertical()
Method Detail

main

public 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. The String argument (args) is not used in this implementation.


query

public static boolean query(java.util.Scanner input,
                            java.lang.String prompt)

writeVertical

public static void writeVertical(int number)
Print the digits of a non-negative integer vertically.

Parameters:
number - the number to be printed
Precondition:
n >= 0. The method does not check the precondition, but the behavior is wrong for negative numbers.
Postcondition:
The digits of number have been written, stacked vertically.

superWriteVertical

public static void superWriteVertical(int number)
Print the digits of an integer vertically.

Parameters:
number - the number to be printed
Postcondition:
The digits of number have been written, stacked vertically. If number is negative, then a negative sign appears on top.