Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (rows = 0; rows < bandstand.length; rows++){
- System.out.print ("Please enter number of positions in row " + (char)(rows + (int) 'A'));
- columns = keyboard.nextInt();
- bandstand[rows] = new double [columns];
- while ( columns < 0){
- System.out.print ("ERROR: Out of range, try again:");
- columns = keyboard.nextInt();
- }
- }
- for (rows = 0; rows < bandstand.length; rows++){
- do {
- System.out.print ("Please enter number of positions in row " + (char)(rows + (int) 'A'));
- columns = keyboard.nextInt();
- } while (columns < 0);
- ...
- for (rows = 0; rows < bandstand.length; rows++){
- System.out.print ("Please enter number of positions in row " + (char)(rows + (int) 'A'));
- columns = keyboard.nextInt();
- while (columns < 0) {
- System.out.print ("ERROR: Out of range, try again:");
- columns = keyboard.nextInt();
- }
- ...
- // note that array is created *after* columns is validated
- for (rows = 0; rows < bandstand.length; rows++){
- System.out.print ("Please enter number of positions in row " + (char)(rows + (int) 'A'));
- columns = keyboard.nextInt();
- if (columns < 0) {
- System.out.println("Columns must be >= 0!");
- continue; // starts over for this row
- }
- ...
- for (rows = 0; rows < bandstand.length; rows++){
- System.out.print ("Please enter number of positions in row " + (char)(rows + (int) 'A'));
- columns = keyboard.nextInt();
- while ( columns < 0){
- System.out.print ("ERROR: Out of range, try again:");
- columns = keyboard.nextInt();
- }
- bandstand[rows] = new double [columns];
- }
- for (rows = 0; rows < bandstand.length; rows++){
- System.out.print ("Please enter number of positions in row " + (char)(rows + (int) 'A'));
- columns = keyboard.nextInt();
- if(columns >= 0) {
- bandstand[rows] = new double [columns];
- }
- while ( columns < 0){
- System.out.print ("ERROR: Out of range, try again:");
- columns = keyboard.nextInt();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement