Question: Create a Java project called Bookstore, which is also your main class. The project additionally has the class Publication. Publication has two data members: genre,

Create a Java project called Bookstore, which is also your main class. The project additionally has the class Publication. Publication has two data members: genre, a string to store the publication's genre, and a string title to hold the publication's title. The class has a constructor to initialize these two attributes. Publications are sorted based on genre first and then title. The class also has the method getinfo ( ) which returns: ,. For example: Charlotte's Web, Children's Books. Create the class Book. This class extends Publication. The class has also the data member author, a string to hold the book's author name. The class has a constructor to initialize its data members. The class overrides Publication's get Info () to add the author's name, such as: Charlotte's Web, Children's Books. Written by E. B. White Create the class Magazine. This class extends Publication. The class has also the data member publisher, a string to hold the magazine's publisher name. The class has a constructor to initialize its data members. It overrides Publication's get Inf() to add the publisher's name, such as: Vogue, Lifestyle. Published by Conde Nast Copy and paste the following code into your main method in Bookstore. Do not modify it. ArrayList myBookstore = new ArrayList >(); myBookstore.add(new Book("Patricia Churchland", "Consciousness", "Neurophilosophy")); myBookStore.add(new Magazine("Springer Nature", "Nature", "Science and Technology")); myBookstore.add(new Publication ("Mastering the game of Go", "Science and Technology")); myBookstore.add (new Book ("LazyTown", "On the Nature of Baking Cakes", "Cakeshop Philosophy")); Collections. sort (myBookstore); for (Publication p : myBookstore) System.out.println (p.getinfo()); The output should look like: On the Nature of Baking Cakes, Cakeshop Philosophy. Written by LazyTown Consciousness, Neurophilosophy. Written by Patricia Churchland Mastering the game of Go, Science and Technology. Nature, Science and Technology. Published by Springer Nature
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
