Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Java class named Bookstore that represents a bookstore. The Bookstore class should have the following components: Data Fields: name ( String ) :

Create a Java class named Bookstore that represents a bookstore. The Bookstore class should have the following components:
Data Fields:
name (String): representing the name of the bookstore.
location (String): representing the location of the bookstore.
books (array of Strings): representing the list of books available in the bookstore.
Constructors:
A default constructor that initializes name and location to default values and initializes an empty array for books.
A parameterized constructor that accepts values for name, location, and an array of book titles to initialize the books array.
Methods:
displayinfo(): a method that prints out the name, location, and list of books available in the bookstore.
addBook(String title): a method that adds a new book with the provided title to the list of books in the bookstore.
removeBook(String title): a method that removes the book with the provided title from the list of books in the bookstore.
searchBook(String title): a method that searches for a book with the provided title in the list of books and returns true if found, otherwise returns false.
Additionally, create another class named BookstoreDemo with a main method to demonstrate the functionality of the Bookstore class. In the main method, create instances of the Bookstore class using both constructors, call each method of the Bookstore class to demonstrate their functionality, and print the results.
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

Explain how the liability of a shareholder is limited.

Answered: 1 week ago

Question

=+ c. a company president deciding whether to open a new factory

Answered: 1 week ago