Write a program that reads in an integer and breaks it into a sequence of individual digits in reverse order. For example, the input 16384 is displayed as

4
8
3
6
1

You may assume that the input has no more than five digits and is not negative.

Declare a class DigitExtractor:

public class DigitExtractor
{
   /**

   Constructs a digit extractor that gets the digits
   of an integer in reverse order.
      \@param anInteger
the integer to break up into digits
   */
   public DigitExtractor(int anInteger) { . . . }


   /**

   Returns the next digit to be extracted.
      \@return
the next digit
   */
   public int nextDigit() { . . . }
}

In your main class DigitPrinter, call System.out.println(myExtractor.nextDigit()) five times.

Complete the following files:

DigitExtractor.java

public class DigitExtractor { . . . /** Constructs a digit extractor that gets the digits of an integer in reverse order. @param anInteger the integer to break up into digits */ public DigitExtractor(int anInteger) { . . . } /** Returns the next digit to be extracted. @return the next digit */ public int nextDigit() { . . . } }

DigitPrinter.java