Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions