This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Please try again. Enter the numerator: E Good Bye Exercise 2: Write a method and then write a main to test it. The method handles the array exceptions. -The method asks the user to enter a size for an array of integers then asks him to fill the array with values. -Ask the user to enter the index for a value and print it on the screen. -The program should continue looping even if there is a problem. -Exit the loop when data entered for the index is a character and display the content of the array. Here is a sample output: Enter the array size: -3 Array size cannot be negative Enter the array size: 3 Enter a value: 1 Enter a value: 2 Enter a value: 3 Enter the index: 4 Bad index Enter the index: 2 The value in index 2 is 3 Enter the index: t The array content is 1 2 3 Good Bye...
View Full Document
- Spring '11
- Java Programming