Posted: September 16th, 2017

Java Application – TableSorter

CS 1181
Assignment 9

Reading

Liang Chapter 7

Java Application – TableSorter

Name the Java Class:  TableSorter

Create a Java application that reads in a Table of Contents from a text file and then displays that Table in sorted order.

Create three parallel arrays. Read the Table of contents from a file named toc.txt.  The first number in the file is the number of chapters followed by a chapter on each row.  Instantiate the arrays to the size indicated and fill the appropriate array with the proper data for each row from the file.
For example: 7;A program by any other name;345
Would be chapter number 7; is titled “A program by any other name”; and starts on page 345.

Create a method to sort the arrays named sortContents that receives the arrays as parameters.  Sort them using whichever approach you would like. However, you must write the sort and cannot use any of the built in sort functions. Section 7.11 on page 279 of the text is a place to find one of the sorting algorithms as well as the demonstration code.

You should create and use a method named displayTable that
Receives three parallel arrays as parameters and then displays the report shown below.

Download the toc.txt file from Moodle and use it for the input in your assignment.

Program output should look like this:

Chapter Title                                                        Page
1 Introduction to Computers, Programming, and Java             1
2 Elementary Programming                                       33
3 Selections                                                   75
4 Mathematical Functions, Characters, and Strings              119
5 Loops                                                        157
6 Methods                                                      203
7 Single-Dimensional Arrays                                    245
8 Multidimensional Arrays                                      287
9 Objects and Classes                                          321
10 Object-Oriented Thinking                                     365
11 Inheritance and Polymorphism                                 409
12 Exception Handling and Text I/O                              449
13 Abstract Classes and Interfaces                              495
14 JavaFX Basics                                                535
15 Event-Driven Programming and Animations                      585
16 JavaFX UI Controls and Multimedia                            629
17 Binary I/O                                                   677
18 Recursion                                                    705

Grading Rubric

TableSorter.java
•    Correct File Name (TableSorter.java) – case sensitive
•    Correct Class Name (TableSorter) – case sensitive
•    Correct Style – comments
•    Correct Style – indentation
•    Correct Style – White Space
•    Free of syntax errors
•    Using toc.txt file supplied on Moodle
•    Open and read toc.txt file
•    Check that the file exists
•    Use try – catch block for file reading
•    Populate arrays of correct size from 1st record in file
•    Fill arrays with values from file
•    Method sortContents
o    Receive arrays as parameters
o    Sort the arrays
•    Method displayTable
o    Receive arrays as parameters
o    Display the Table of Contents

Upload

Upload the source code file (TableSorter.java) using your Moodle account for the course into “Assignment 9 Submission”

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Live Chat+1-631-333-0101EmailWhatsApp