
/**
 *
 * demonstration of do ... while
 *
 * Written by: Roger Garside
 *
 * First Written: 19/March/97
 * Last Rewritten: 19/March/97
 *
 */

import java.lancs.* ;

public class Chapter5n10
    {

    /**
     *
     * main
     *
     */

    public static void main(String[] args) throws Exception
        {
        String response ;

        do
            {
	    BasicIo.prompt("type a number ") ;
	    int n = BasicIo.readInteger() ;

	    System.out.print("the value of " + n) ;
	    System.out.println(" is " + (n * n)) ;
	    BasicIo.prompt("calculate more numbers (y or n)? ") ;
	    response = BasicIo.readString().toLowerCase() ;
	    }
	while ((response.length() > 0) && (response.charAt(0) == 'y')) ;
        } // end of method main

    } // end of class Chapter5n10

