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”

Calculate your order
275 words
Total price: $0.00

Top-quality papers guaranteed

54

100% original papers

We sell only unique pieces of writing completed according to your demands.

54

Confidential service

We use security encryption to keep your personal data protected.

54

Money-back guarantee

We can give your money back if something goes wrong with your order.

Enjoy the free features we offer to everyone

  1. Title page

    Get a free title page formatted according to the specifics of your particular style.

  2. Custom formatting

    Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.

  3. Bibliography page

    Don’t pay extra for a list of references that perfectly fits your academic needs.

  4. 24/7 support assistance

    Ask us a question anytime you need to—we don’t charge extra for supporting you!

Calculate how much your essay costs

Type of paper
Academic level
Deadline
550 words

How to place an order

  • Choose the number of pages, your academic level, and deadline
  • Push the orange button
  • Give instructions for your paper
  • Pay with PayPal or a credit card
  • Track the progress of your order
  • Approve and enjoy your custom paper

Ask experts to write you a cheap essay of excellent quality

Place an order

Order your essay today and save 7% with the discount code DISSERT7