All pastes #183453 Raw Edit

Anonymous

public java v1 · immutable
#183453 ·published 2006-09-26 22:51 UTC
rendered paste body
/*	         * Catch any and all errors (type mis-match errors) that way we don't	         * crash the user of this program :-)	         */	        try	        {	        	/*		         * Ask the user for how many test scores will be entered		         */	    	    System.out.print("Enter the number of test scores to be entered: ");	    	    	    	    /*	    	     * Grab the test scores count	    	     */	    	    numberOfEntries = sc.nextInt();	        }	        /*	         * Catch that bad error!	         */	        catch(InputMismatchException e)	        {	        	/*	        	 * Discard the invalid data entry	        	 */	        	sc.next();	        		        	/*	        	 * Notify the user of their mistake	        	 */	        	System.out.println("Error! Invalid number. Please try again.\n");	        		        	/*	        	 * Jump back into the loop	        	 */	        	continue;	        }