import simpleIO.*;

public class CubeTable extends SimpleGUI {

	// Data fields	
   private int TableSize;    // number of rows in the table
   private int StartRow;     // starting row number
   private int RowIncrement; // increment between rows

	// Methods
   public void PrintTables()
   // Keep printing tables until user enters zero
   {
        GetSize();
        // loop until TableSize is zero               
        while (TableSize != 0)
        {
             GetStart();
             ShowCubes();
             GetSize();
        }
   }


	public void GetSize()
   {
	     TableSize = getInt("Enter number of rows in table (0 to end):");
        while (TableSize < 0)
        {
             displayResult ("Rows must be non-negative.");
	          TableSize = getInt("Enter number of rows in table (0 to end):");
        }
	}

	public void GetStart()
   {
	     StartRow = getInt("Enter the starting row number:");
        while (StartRow < 0)
        {
             displayResult ("Start row must be non-negative.");
	          StartRow = getInt("Enter the starting row number:");
        }

	     RowIncrement = getInt("Enter the row increment:");
        while (RowIncrement <= 0)
        {
             displayResult ("Row increment must be positive.");
	          RowIncrement = getInt("Enter the row increment:");
        }

	}

	public void ShowCubes()
   {
        displayResult ("A cube table of size " + TableSize + " will appear here starting at " + 
          "row " + StartRow + "incrementing by " + RowIncrement);
        displayResult ("the sum will appear here.");
	}

} // class CubeTable