Jordan Cozart

Greenhorn
+ Follow
since Feb 06, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jordan Cozart

Pastebin
Pastebin
Pastebin
The links above take you to the three classes i have.


I need to write a class called Book that has 3 Attributes: title, author, and category. The class has a constructor, a getter for the category, and a toString method. The toString method should return a string that has the same format as this example: How To Finish Homework On Time by Will B. Dunn, category: nonFiction. After that i need to write a driver class that has 3 stacks: toBeSorted, fiction, and noFiction. The driver class should push all the books from the file books.txt onto the toBeSorted stack(which i have already done). The driver class should then iterate through the toBeSorted stack, display the book on top of the stack (Hint: This is where the toString method in the Book class comes in), and sort them by category. That means to  push each book onto the fiction or nonFiction stack, based on its category and then pop the book of the toBeSorted stack. At the end, the program should display the number of books on each stack, if the toBeSorted stack is empty, and which book is on top of each of the other stacks.
1 week ago