Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help the code for point e), the one that deals with option 2 in java language You are hired by a bookstore to

I need help the code for point e), the one that deals with option 2 in java language

image text in transcribed

image text in transcribed

You are hired by a bookstore to write a software that helps the store owner in keeping track of the books at the store. Write a driver program that will contain, at least, the following methods. Note: You can have the main function in a separate driver file, or in the same file if you prefer 1. a main0 method, that will a. Display a welcome message b. Prompt the bookstore owner 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 Display a main menu (fig 1) with the following choices and keep prompting the user until they enter a number between 1 and 5 inclusive: c. What do you want to do? 1. 2. 3. 4. 5. Enter new books (password required) Change information of a book (password required) Display all books by a specific author Display all books under a certain a price. Quit Fig 1. Main men Please enter your choice> d. When option 1 is entered i. Prompt the bookstore owner for his/her password. (Make sure you have a constant variable containing the password "password" - do not use any other password as it will be easier for the marker to check your assignments). The bookstore owner has a maximum of 3 attempts to enter the correct password. After the 3"d illegal entry, the main menu in figure 1 is re-displayed again. Additionally after this process is repeated 4 times (i.e. total failed attemopts is 12 by now), the program must displays the following messages: "Program the program must exits. detected suspicous activities and will terminate immediately!", then e. When option 2 is entered: i. Prompt the bookstore owner for his/her password. (Make sure you have a constant containing the password "password" as a constant - do not use another password). Again the bookstore owner has 3 attempts to enter the correct password. However, after the 3rd illegal entry, the main menu in figure 1 is simply re-displayed again (notice the different behaviour in that case from the previous one above) ii. Ask the user which book number s/he wishes to update. The book number is the index in the array inventory. If there is no Book object at the specified index location, display a message asking the user if he/she wishes to re-enter another book, or quit this operation and go back to the main menu. If the entered index has a valid book, display the current information of that book in the following format: Book # X Author: name of author Title: title of book ISBN: isbn # Price: Sprice Then ask the user which attribute they wish to change by displaying the following menu What information would you like to change? 1. author 2. title 3. ISBN 4. price 5. Quit Enter your choice> Fig 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 u 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

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

What is the name and web address of the blog?

Answered: 1 week ago