Answered step by step
Verified Expert Solution
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.
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started