prompt the user for an int between an upper and


Prompt the user for an int between an upper and lower boundary. Reuse the validateInput() method from project 2 to validate if the input is in bounds. If it is not, print an error that the given input is not greater than the lower bound and not less than the upper bound, then end the program.
If input is in bounds, create an array of type String of that length. Loop the length of the array. For each array element, generate a random number from 0 to 9. Reuse the convertInput() method from project 2 and put into each array element the String value that corresponds to the random number.
Create a second loop that prints the contents of the array as array index followed by the array index contents. Use the escape character for the tab stop to line up the output.
Your upper and lower boundaries should be constants. Use 1 as lower and 20 as upper boundaries.
Sample:
C:\Users\andy\java\141\p3>java Java1302CMIS141C801Project
Enter size of the array, between 1 and 20. -3
Invalid input. -3 is not >= 1 and <= 20.

C:\Users\andy\java\141\p3>java Java1302CMIS141C801Project
Enter size of the array, between 1 and 20. 2332
Invalid input. 2332 is not >= 1 and <= 20.

C:\Users\andy\java\141\p3>java Java1302CMIS141C801Project
Enter size of the array, between 1 and 20. 5
The contents of the 5 element array:
0. zero
1. zero
2. six
3. three
4. two
End of array contents.

Project 2 uses: (previous project, Have source code if you need a reference.)
Your static methods will be:
public static boolean validateInput(int); // returns true if the length of the int parameter is 1 digit long. Returns false otherwise.
public static String convertInput(int); // returns a string of the word that represent the integer passed as an argument.

Posted Date: 7/10/2013 4:19:08 AM | Location : United States

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: prompt the user for an int between an upper and
Reference No:- TGS0357233

Expected delivery within 24 Hours