Array prints random numbers into string, JAVA Programming

Assignment Help:
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.


Related Discussions:- Array prints random numbers into string

Code, Ask question how to implement a decision tree in java #Minimum 100 wo...

Ask question how to implement a decision tree in java #Minimum 100 words accepted#

Multitreading, what is multithreading in Java? Explain with example.

what is multithreading in Java? Explain with example.

What are the implicit objects in jsp, Implicit objects are formed by the we...

Implicit objects are formed by the web container and have information related to a particular request, page, or application. They are request, response, pageContext, session, appli

Batch file, how to create batch files of java program

how to create batch files of java program

What are the kinds of computer network, What are the kinds of computer netw...

What are the kinds of computer network according to the distance among nodes? The kinds of computer network according to the distance among nodes are: 1. LAN 2. WAN

Multidimensional Array and the ArrayList Class, Write a ComputerPart class ...

Write a ComputerPart class and a ComputerKit class and a client class to test them. The ComputerPart class has two variables: a String representing an item, and a double representi

Collections, Write a program to proove that HashSet maintains random order

Write a program to proove that HashSet maintains random order

Three ways in which a thread can enter the waiting state, What are three wa...

What are three ways in which a thread can enter the waiting state ?

What is the string concatenation, What is the String Concatenation + Op...

What is the String Concatenation + Operator is employed to concatenate strings - System.out.pritln ("Hello" + "World") will print Hello World on console String concatenat

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd