The program is designed to iteratively capture the name of students. The program makes use of an ArrayList data structure that implements the List interface to allow the user to enter an arbitrary number of students into the program. Through using a loop, the program allows a user to perform the same operation a given number of time (Langsam, Augenstein & Tenenbaum, 2003). In this specific instance, the loop allows the entry of the student name the specified number of times. The program allows the user to specify the number of students, after which a counter is set and the program performs the operations necessary to capture the specified number of users. This is a good coding practice since it eliminates the possibility of errors in code.
The second good coding practice seen in this code lies in the use of an ArrayList. This data structure allows for the storage and manipulation of data collections without prior need for establishing the length. If an array had been used in a similar instance, then the array length would have had to be predetermined (Riley, 2003). In this instance, the use of an array to store student names would have necessitated the declaration of the number of elements the array was to hold. This would have been fine for say a class with a known number of student, but an inherent limitation emerges. The limitation arises from the fact that the code would not be used for any other class, except if it had the same number of students (Sierra & Bates, 2005). The code might be applied to cases where the number of students was less than that of the length of the array which case it would waste memory. Evidently, the use of ArrayLists presents a good coding practice.
References
Langsam, Y., Augenstein, M., & Tenenbaum, A. (2003). Data structures using Java. Upper Saddle River, N.J.: Pearson Prentice Hall.
Riley, D. (2003). The object of data abstraction and structures using Java. Boston: Addison Wesley.
Sierra, K., & Bates, B. (2005). Head first Java. Sebastopol, CA: O’Reilly
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more