Java Application – Chapter and ChapterReader
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 _
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.
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.
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.