Part IFor this part, you are required to design and implement the Book class according to the following specifications: A book object has four attributes, a book title (String), an author name (String), an ISBN number (long), and a price tag (double). Upon the creation of a book object, the object must immediately be initialized with valid values; that is title, author name, ISBN number and price value. (Hint: use constructors.). The design should allow enough flexibility so that the value of any of these attributes can be modified later on. For example, it should be possible to create a book object with a given price then change its price later on. The design should also allow the user to obtain the value of any of the attributes. (Hint: use accessors & mutators.) The design should allow all information of an object to be displayed at once through the utilization of System.out.print() method. (Hint: use toString() method). It is required to know how many Book objects have been created. For that, you need to add a method, called findNumberOfCreatedBooks(), to the class. This method must return the number of created Book objects prior to the time this method is called. The method would simply return 0 if no books has been created by the time the method is called. (Hint: use Static You are allowed to add other attributes to the class.) . It is required to compare two Book objects for equality. Two Book objects are considered equal if they have the same ISBN and price. (Hint: use equals() method). It is required to display any Book object (all info of that object) using System.out.println() method. (Hint: use toSting() method).Part IIYou are hired by a bookstore to write a software application that helps the store staff (users) in keeping track of the books at the store.Write a driver program that will contain the main()method and it will perform the following:(Note: You can have the main function in a separate driver file, or in the same file if you prefer) Display a welcome message. Prompt the user for the maximum number of books (maxBooks) his/her bookstore can contain. Create an empty array, called inventory, that will have the potential of keeping track of the created Book objects.COMP249/Winter 2018 Assignment 1 Page 2 of 4What do you want to do?1. Enter new books (password required)2. Change information of a book (password required)3. Display all books by a specific author4. Display all books under a certain a price.5. QuitPlease enter your choice > Display a main menu (figure 1) with the following choices and keep prompting the useruntil they enter a number between 1 and 5 inclusive:figure 1. Main menu When option 1 is entered: Prompt the user for his/her password. (make sure you have a constant variable containingthe password password do not use any other password as it will be easier for themarker to check your assignments). The user has a maximum of 3 attempts to enter thecorrect password. After the 3rd wrong attempt entry, the main menu in figure 1 is redisplayedagain. Additionally after this process is repeated 4 times (i.e. total failedattempts is 12), the program must displays the following messages:Program detected suspicous activities and will terminateimmediately!, then the program must exits. If the correct password is entered, ask the user how many books he/she wants to enter.Check to make sure that there is enough space in the bookstore (array of Book) to addthat many books. If so, add them; otherwise inform the user that he/she can only add thenumber of remaining places in the array. (How the book information will be input/enteredby the user, is up to you). When option 2 is entered : Prompt the user for his/her password. (make sure you have a constant containing thepassword password as a constant do not use another password). Again the user has3 attempts to enter the correct password. However, after the 3rd wrong attempt entry, themain menu in figure 1 is simply re-displayed again (notice the different behaviour in thatcase from the previous one above). Once the correct password was entered, the user is asked which book number he/shewishes to update. The book number is the index in the array inventory. If there is noBook object at the specified index location, display a message asking the user if he/shewishes to re-enter another book, or quit this operation and go back to the main menu. Ifthe entered index has a valid book, display the current information of that book in thefollowing format:Book: # x ( index of the book in the inventory array)Author: name of authorTitle: title of bookISBN: ISBN #Price: $ priceCOMP249/Winter 2018 Assignment 1 Page 3 of 4 Then ask the user which attribute they wish to change by displaying the following menu.figure 2. Update menu Once the user has entered a correct choice, make the changes to the attribute then display again all of the attributes on the screen to show that the attribute has been changed. Keep prompting the user for additional changes until the user enters 5. Each time the user is prompted for a choice make sure that a number from 1 to 5 is entered, otherwise keep prompting until a valid number is entered. (ensure that the user is able to change any of the choice 1 to 4 on figure 2) . When option 3 (in the main menu shown in figure. 1) is entered, prompt the user to enter an author name. You then need to display the information of all books by that requested author. (Hint: You may use a static method, for instance called findBooksBy , which accepts a string for an author name then performs the needed search). When option 4 (in the main menu shown in figure. 1) is entered, prompt the user to enter a value (representing a price). You then need to display all books that have a vlaue smaller than that entered value. (Hint: You may use a static method, for instance called findCheaperThan, which accepts a double value, for a price, then performs the needed search). When option 5 (in the main menu shown in figure. 1) is entered, display a closing message and end the driver.
JavaDoc Documentation:Documentation for your program must be written in javaDoc.In addition, the following information must appear at the top of each file:Name(s) and ID(s) (include full names and IDs)COMP249Assignment # (include the assignment number)Due Date (include the due date for this assignment)
Reviews
There are no reviews yet.