View the step-by-step solution to:

ArrayLists Function: The program will display list of number in the original order, ascending and descending. How to accomplish the task: Follow the...

This question was answered on Mar 26, 2010. View the Answer
Need to write a java program that uses array lists. The program should consist or a manager class that only has call statements and a worker class that contains methods that do the work. It reads numbers from a text file and the output is also to a file. Full assignment is attached.

This is what the input file looks like:
1
12
2
3
31
42
6
4
4
46
15
18
6
8
25
39
13
5
2
9
45
14
16
56
72
21
23
33
11
999
Lab: ArrayLists Function: The program will display list of number in the original order, ascending and descending. How to accomplish the task: A. Follow the Manager, Worker classes, methods and documentation style described in previous labs. (1 point) B. Use the data file named “Lab9.txt”. (1 point) C. Write a program that will: a. input the data from the file into an arrayList named numbersXX . Use the “trailing value” technique to input the numbers. Keep inputting until a 999 is entered. The 999 is the “trailing value” and not part of the input list. (2 points) b. create another arrayList named ascendXX. You will receive no credit if you use a sorting technique to form the new list. (5 points) i. To create this list put the first item from the numbersXX list into the ascendXX . ii. Next, compare the second item in the numbersXX list to the value in the ascendXX , if the value in the numbersXX list is smaller than the value in the ascendList, put the new number into the ascendXX before the current value. If it is not smaller and you are at the end of the ascendXX , then put the new number at the end of the ascendXX . iii. Repeat the process of placing the values in the numbersXX list into the ascendXX until the ascendXX has all the original numbers, but in ascending order. c. print the output to the file named “Lab9xx.txt” (where xx are your initials): i. The phrase “Original List –“, then the numbersXX list on one line with commas between each entry (and no comma after the last entry). (2 points) ii. One blank line then the phrase “Ascending List –“, then the ascendXX on one line with commas between each entry (and no comma after the last entry). (2 points) iii. One blank line then the phrase “Descending List –“, then the ascendXX in reverse order on one line with commas between each entry (and no comma after the last entry). Do not create a 3 rd arraylist. (2 points) D. If you manually manipulate the input or output files in any way, you will get no points for this part of the assignment. Your code should produce the expected output from the given input.
Background image of page 1

Top Answer

Dear Student,... View the full answer

solution.zip - Preview not available

This question was asked on Mar 25, 2010 and answered on Mar 26, 2010.

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors and customizable flashcards—available anywhere, anytime.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access or to earn money with our Marketplace.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
  • -

    Flashcards

    Browse existing sets or create your own using our digital flashcard system. A simple yet effective studying tool to help you earn the grade that you want!

    Browse Flashcards