import java.io.*;

/*---------------------------------------------------------------------------------------------	
CS100 P3: Q1

Prompts the user for a positive integer n, then prints the integers from 1 to n, 
along with their squares, square roots, and cubes in a four column table.

Author 	:   Alan Renaud (ajr5@cornell.edu)
Date		:   23 July 1999	
------------------------------------------------------------------------------------------------*/
class FormattingOutput {
	
	static TokenReader in = new TokenReader(System.in);
	
	public static void main (String[] args) 
	{
		int n = getInput("Please enter a positive integer: ");
		if (n > 0)
		{
			System.out.println("\tn\t\tsqr(n)\t\tsqrt(n)\t\tcube(n)");
			for (int count = 1; count <= n; count++) 
			{
				Format.print(System.out, "%9.1f\t ", (double) count);
				Format.print(System.out, "   %9.1f\t  ", (double) Math.pow(count,2));
				Format.print(System.out, "   %9.1f\t  ", (double) Math.sqrt(count));
				Format.println(System.out, "   %9.1f  ", (double) Math.pow(count,3));
			}
		}
		else
			bye();

		in.waitUntilEnter();
	}

	/*---------------------------------------------------------------------------------------------	
	getInput
	
	input	:   	message string
	return	:	value input by user
	
	Returns value of user's input.
	------------------------------------------------------------------------------------------------*/	
	private static int getInput(String message) 
	{
		System.out.print(message);
		System.out.flush();
		return in.readInt();
	} 

	/*---------------------------------------------------------------------------------------------	
	bye
	
	input	:   	none
	return	:	none
	
	Prints goodbye message when user elects not to follow instructions.
	------------------------------------------------------------------------------------------------*/		
	private static void bye() 
	{
		System.out.println("\nYou didn't enter a positive integer.");
		in.waitUntilEnter();
	}
		
}