BookRatingOOP Program
Description
Use OOP approach to write BookRating programThis program uses an array of Book objects to store book information (title and rating) and uses several methods to do the following:
Determine the number of books in the data file
Fill in the arrays with the data in the data file
Calculate the average rating
Find the book with the highest rating (assume there is no tie)
Print books' title and rating
Fill in the arrays with the data in the data file
Calculate the average rating
Find the book with the highest rating (assume there is no tie)
Print books' title and rating
Associated Concepts:
Array
OOP
File Input / Output
JFileChooser class
OOP
File Input / Output
JFileChooser class
Algorithm:
For Book class, the class diagram is represented in
UML (Unified Modeling Language) notation.
Client program:
Client program:
Use JFileChooser object to select the data file
Determine the number of books in the data file
Create an array of Book
Call methods to:
Determine the number of books in the data file
Create an array of Book
Call methods to:
Populate the arrays with data in the data file
Print array elements
Calculate the total rating
Find the index of the book with the highest rating and print the result
Print the average rating
Print array elements
Calculate the total rating
Find the index of the book with the highest rating and print the result
Print the average rating
Source Code
Input File BookRating_Data.txt: