Question: FictionBook Ranking You are tasked with creating a program for adding Fiction Books library ranking. Each book will have a name, genre, number of copies

FictionBook Ranking
You are tasked with creating a program for adding Fiction Books library ranking. Each book will
have a name, genre, number of copies sold, and percentage sold. You will also determine the total
number of books added and the total number of all books sold.
Requirements
Create two Classes, a driver class called BookRanking, and a class FictionBook
FictionBook will have following parameters and are all private:
1. Name
2. Number of copies sold
3. Genre
4. Percentage of books sold
5. Total Number of books added, it must be a static variable
6. Total Number of books sold for all books, it must be a static variable
FictionBook must have these user-defined Non-Static methods
1. Method to get total number of books added
2. Method to get total number of books sold for all books
3. Methods for all private parameters (getters and setters)
4. Dont create methods for setting number of books added or total number of book sold
FictionBook must this Overloaded Constructor
1. It will accept only, the name and number of copies sold as parameters.
2. Hint, you will need to have the static parameters here
3. Hint, the genre will be set using a method
BookRanking can have as many parameters as needed
BookRanking will have method main which will have this non-static object:
1. FictionBook[] books = new FictionBook[5];
BookRanking must have these user-defined Static methods
1. Method to create an array of books - All user inputs must be done in this method
2. Method to determine the percentage sold and it add to the array
3. Method to print the results - results retrieved via loop and getter methods.
Use this template for the print method:
private static void printResults(An array of FictionBook){
String sStars = String.format("%73s","").replace('','*');
System.out.printf("%n%s", sStars);
System.out.printf("%n|%-20s |%-20s |%-12s |%-12s", "Name ","Genre", "Books
Sold", "Percentage");
For loop
System.out.printf("%n|%-20s |%-20s |%-12d |%-12.2f", Value for Name, Value
for Genre, Value for Copies sold, Value for Percent Sold );
End of For Loop
System.out.printf("%n%s%n", sStars);
System.out.println("The total number of books: "+ Value for number of books);
System.out.println("The total number of books sold: "+ Value for total number of
books sold);
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!