Arrays, 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.

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

Related Discussions:- Arrays

Online doctor, can you explain me the er diagram for the online doctor syst...

can you explain me the er diagram for the online doctor system

What is testing for equality in java, What is Testing for Equality in java?...

What is Testing for Equality in java? Testing for equality is a little trickier. You would expect to test if two numbers are equal through using the = sign. However the = sign

Different messaging paradigms jms supports, What are the different messagin...

What are the different messaging paradigms JMS supports? Ans) Publish and Subscribe i.e. pub/suc and Point to Point i.e. p2p.

Define when to use hashmap and when to use treemap, How do you decide when ...

How do you decide when to use HashMap and when to use TreeMap? When we want to perform deletion, insertion and locate elements in a Map then HashMap is used. Whereas TreeMa

How can we involve images within a web page, How can we involve images with...

How can we involve images within a web page using HTML and Java script? Images can be included in HTML through employing tag, below is the format of

Explain role of actionservlet , ActionServlet performs the role of Contro...

ActionServlet performs the role of Controller: ? Process user requests ? Verify what the user is trying to achieve according to the request ? Pull data from the model (if

Develop a custom android app, Develop a Custom Android App Project Descr...

Develop a Custom Android App Project Description: We want you to construct a custom Android app. Once user downloads the app and upon installation the user gets push notif

Streaming and decorator construction in java i/o, Java output and input is ...

Java output and input is described in terms of an abstract concept named a " stream ", which is a sequence of data. There are 2 types of streams. 1.      Byte streams (8 bit

K-means clustering, i) Set the number of data points to 20 and the number o...

i) Set the number of data points to 20 and the number of clusters to 2. Check box Show History. Click on Initialize. Click on Start. Click on Step . Observe which points ch

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