Question: 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.
addBookString title: a method that adds a new book with the provided title to the list of books in the bookstore.
removeBookString title: a method that removes the book with the provided title from the list of books in the bookstore.
searchBookString 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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
