CSE 174 – Assignment 4
JAVA作业代做 You are to write a program that reads data from a file, and creates and works with an ArrayList of Shipping objects.
You are to write a program that reads data from a file, and creates and works with an ArrayList of Shipping objects.
- Create a new class/file called Assignment4.
- Download the API Documentation for Shipping Class.
- Download thejava(DO NOT CHANGE ANYTHING INSIDE THIS FILE), smallInput.txt, and largeInput.txt files and put them in the same folder as your Assignment4.java file.
For this assignment you are allowed to use everything you have learned so far to generate the expected output. JAVA作业代做
There are only 2 limitations that you must follow:
- The length of methods (including the main method) should be less than 35 lines.
- Your class must have 2 public sort methods called sort1and sort2 which are explained later.
Other than that, you can use anything that you have learned in this course.
The quality of your code will be evaluated by the assessor and points will be taken off if you don’t follow the proper programming practices. So, avoid using things that we have never used in the course.
The Data Files JAVA作业代做
The data files are divided into four columns: column one is the transport ID, column two is the shipment ID,column three is the receiver name, and column four is the tracking number
Part1: Run the program
When your program is run, the following menu needs to be displayed:
At this point nothing has been read from the file, so if the user chooses menu options from 2-5,nothing should happen and the user should be prompted with a proper message as the following:
Part2: Reading from a file & creating an ArrayList of Shipping objects
When the user enters 1, it asks the user to enter a filename and starts reading data from the given file and creates an ArrayList of Shipping. The following is the result:
When option 1 is done:
- The user can enter 2 to display the list.
- Choosing number 2 only displays 10 elements at a time. If the user enters character ’s’, it will stop showing the rest of the list. If the user enters anything else, it will show the next 10 elements of the list and so on.
- At this level if the user enters number 5, nothing should be printed because the list hasn’t been sorted yet.
The results are as follows:
Part3: Sorting JAVA作业代做
Your class must have 2 sort methods called sort1 and sort2. These two methods both accept an ArrayList of Shipping objects and return nothing. From the sorting algorithms that you have learned so far (bubble sort, selection sort, and insertion sort) you can pick any one you like for sort1 and sort2 methods. For instance, you can use bubble sort for sort1 and insertion sort for sort2, or you can use the same sort algorithm for both sort1 and sort2 methods.
The sort1 method should sort the list based on shipmentID, and the sort2 method should sort the list based on the trackingNumber.
- When the user enters 3, the list should be sorted by shipmentID.
- When the user enters 4, the list should be sorted by trackingNumber.
- The lastsorted list can be displayed by entering 5.
- If the user enters 2, the original, unsortedlist still needs to be displayed as before.
The results are as follows:
Sorting based on shipmentID
Sorting based on trackingNumber
Even after sorting, the original unsorted list should be displayable
Part4: Loading another file
If the user enters 1 again to load another file, everything will be repeated from part2. Please go back and read part2 of this assignment again.
Part5: Test your code with more sample runs
Just follow the following sample runs to test your code and make sure that your code is generating the same results.
Load from a file and print the original, unsorted list
Sort based on shipmentID and print the sorted list
Sort based on tracking numbers and print the sorted list
Even after sorting, the original unsorted list should still be printable.
Another Sample Run
Part6: Submit on Canvas JAVA作业代做
If your program worked as shown above, now it’s time to submit your work on Canvas. The Code Plugin will test the result of your code, along with sort1 and sort2 methods.
Rubric
Criteria | Full Credit | Partial Credit | No Credit |
Successful submission via Code | A fully successful
submission to CODE that passes all tests will earn full credit. 60 Points |
Complete each test.
12 Points |
If your submission is
not accepted by code, you will receive no credit. 0 Points |
Correct Style | Zero style errors,
will earn full credit. 10 Points |
Any style errors present,
you will receive no credit. 0 Points |
|
Proper programming
practices |
If your code follows all
acceptable practices, you will earn full credit 30 Points |
Unacceptable
code gets partial credit.
|
Significant issues related
to programming practices will earn no credit. 0 Points |
更多代写:Python作业代写 线上考试如何作弊 Stata作业代写 Literature Review代写 Management论文代写 写总结