Posted: April 3rd, 2015

Java Application – Chapter and ChapterReader

Java Application – Chapter and ChapterReader

Chapter.java

Create a class to encapsulate the data and behavior of a chapter from Assignment 9.  The class should have something like the following fields:

Chapter Number – int
Chapter Title – String
Starting Page Number – int
Ending Page Number – int

Use appropriate access modifiers when defining the data

Code accessor and mutator (get and set) methods for all class instance variables. Be sure to follow the class style and use _<classInstanceVariable> as the name for the parameter corresponding to the class instance variable. (Note the “_” starting the parameter name.) You will need to make a method that returns the number of pages in the chapter.

If the chapter title is blank, or the values passed for the chapter number or page numbers are not valid, leave the associated instance variable unchanged.

ChapterReader.java

The main method in this class should read the table of contents from a text file named toc.txt and use the class mutators to put the information into the Chapter object. The Chapter object should then be passed to a method to display chapter information using the class accessors and member method.

toc.txt
The toc.txt file contains semi-colon delimited fields for the chapter number, title, starting page, and the ending page for each book chapter. Download this file from Moodle and use it in your application.

The program output should appear as shown here:

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

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