class Ticker
{
public void countDownNT(int n) // oops tail recursion
{
if (n == 0)
{
System.out.println("LIFTOFF");
}
else
{
System.out.println("T minus " + n + " seconds...");
countDownNT(n-1);
}
}// end countDownNT
private void doCountDownRT(int n, int check)
{
if (n == check)
{
System.out.println("T minus " + n + " seconds...");
}
else
{
doCountDownRT(n+1, check);
if(n > 0)
{
System.out.println("T minus " + n + " seconds...");
}
else {
System.out.println("LIFTOFF");
}
}
} // end countDownRT
public void countDownRT(int n)
{
doCountDownRT(0, n);
}
} // end class