Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Note: The question requires you to use an array and not any Java library class to store the data.

Question

A bookstore owner wants to maintain information about all the books in stock. Design, write in Java, test and document a program which must have at least two class definitions:

  • A book class which can be used to represent the details of a book together with some associated operations, and
  • A client class of the book class

The book class will have data members described as follows, which should be declared as private:

(a) Title of the book - a string of characters

(b) Name of the first author (surname followed by first name or initial) - a string of characters

(c) Publisher - a string of characters

(d) Year of publication - an integer

(e) ISBN - a long integer

(f) Price - a float or double

(g) Number of copies in stock (quantity) - an integer

Include the member methods to perform the various operations on the objects of book class. For example, the usual operations that can be performed on the title are to get the title and to set the title. Similarly, the typical operations that can be performed on the number of copies in stock are to get the number of copies in stock, set the number of copies in stock, and update the number of copies in stock (i.e. increase the quantity of existing stock). Add similar operations for the publisher, year of publication, ISBN, book price, and author. The book class will have at least the following constructors and methods:

(i) Two constructors - one without any parameters (the default constructor), and one with parameters to give initial values to instance variables

(ii) A reasonable number of set, get and update methods to perform the various operations as explained in the above paragraph

(iii) Input and output methods

(iv) A method which calculates and returns the total value (in dollar terms) of a particular title (book) in stock

(v) An equals method which compares two book objects and returns true if they have the same title, the same author and the same ISBN

You may add other methods as you see appropriate. However, you will need to document them clearly. The program will allow entry of these data for several books and perform some analysis and queries. Your program will provide the user with a menu which allows the following actions:

1. Quit

2. Create an array of N books. For each book, read in its details (i.e., title, name, publisher, year of publication, ISBN, price, and quantity in stock) from the keyboard, and store it in the array. Test it with N = 6. Do not use any java library class to store the books.

3. Output details (all information) of all books currently in stock;

4. View all information about a book chosen via its ISBN number. If the book is not in stock, an appropriate error message is to be displayed;

5. View all information about a book chosen via its author. If the book is not in stock, an appropriate error message is to be displayed. If there is more than one book by this author, the details of all those books should be displayed.

6. Given an ISBN, update the number of copies (quantity) of a book. If the book is not in stock, an appropriate error message is to be displayed;

7. Given the title of a book, update its price. If the book is not in stock, an appropriate error message is to be displayed;

8. Determine and display details of the most expensive book in stock;

9. Determine and display the quantity of total stock in the array (bookstore);

10. Determine and display the monetary value of total stock in the bookstore;

11. Add a new book to the array. Note that this operation will increase the array size by 1.

12. Given a book's ISBN, delete/remove an existing book from the array. If the book is not found display an appropriate error message. Note that if delete is successful, it will reduce the array size by 1.

13. Using one of the sorting methods described in the lecture notes, sort the array of book objects into ascending (alphabetical/dictionary) order of their first authors, and output the sorted array.

Set up a bookstore (an array) of N book objects, and test it with N = 6.

There is no requirement for the program to store data when the program quits. The interaction with the user is via a (command line) menu.

The client class should be well-structured and should have a reasonable number of methods in addition to the main method. Devise suitable test data to test all sections of program code.

Your program should also include a method (eg, StudentInfo( )) to output your student details (name, student number, mode of enrolment, tutor name, tutorial attendance day and time) at the start of program results.

Note: The question requires you to use an array and not any Java library class to store details of books. Also, the sorting algorithm used must be coded within your program and not called from any Java libraries.

Suggested Design

The following design is recommended but not compulsory. You will get a good practice at using arrays and some solid and useful object-oriented design. The task is just complicated enough to make it really worth your while to think carefully about dividing up the code into several classes. Start working on the assignment early so that you have time to leave any seemingly tricky bits alone for a while to rethink them and/or talk to your tutor about them. Approach the development in a systematic way using stubs and driver programs as required. We have covered all the necessary techniques in Topics 1 to 7.

You should at least have a book class and a client class which works with an array of books. You need to think carefully about which tasks can be dealt with just inside the book class and which tasks involve the whole array of books.

Whichever, overall design you use, most of the work will then be in getting the algorithm right inside the methods and catering for the convenience of the user.

Distribution of marks for assessment

An approximate distribution of marks for assessment is given below. The question will be marked out of 100 as follows:

Correct solution design and implementation:

(which includes the design and implementation of classes as specified in the question above; programming style, use of comments, use of methods, parameters, input validation, readability, presentation of output etc.)

External Documentation (problem specification, algorithm, program limitations, program testing and test results, program listings, etc.):

For internal documentation (ie in the source code) we require:

  • a beginning comment clearly stating title, author, date, file name, purpose and any assumptions or conditions on the form of input and expected output;
  • other comments giving useful low-level documentation and describing each component;
  • well-formatted readable code with meaningful identifier names and blank lines between components (like methods and classes).

Required External Documentation:

1. Title: a paragraph clearly stating title, author, date, file names, and one-line statement of purpose.

2. Requirements/Specification: a paragraph giving a brief account of what the program is supposed to do. State any assumptions or conditions on the form of input and expected output.

3. User Guide: include clear instructions on how to access, compile and run the program.

4. Structure/Design/Algorithm: Outline the design of your program. Give a written description, use diagrams (eg, UML) and use pseudocode for algorithms.

5. Limitations: Describe program shortfalls (if any), eg, the features asked for but not implemented, the situations it can not handle etc.

6. Testing: describe your testing strategy (the more systematic, the better) and any errors noticed. Provide a copy of your results of testing in a document saved in Word format. Note that a copy of the sample test data and results from a program run is required (copy from the program output window and paste to a Word file). Your submitted test results should demonstrate a thorough testing of the program.

7. Source program listings: save all your Java source code in a document in MS Word format.

All of the above external documentation must be included in that order in a file saved in MS Word format.

It is also necessary to submit the Java source code and compiled version of your programs (i.e., all classes that you have designed and implemented). You should develop the programs using the NetBeans IDE. It will make it easy to collect sample output. The whole NetBeans project should be submitted.

The external documentation together with the NetBeans project folder containing all classes for the program must be compressed in a .zip file before submitting. Make sure that all necessary files are submitted so that the programs can be viewed, compiled and run successfully.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92261850
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Suppose we have a collection of n different subsets of the

Suppose we have a collection of n different subsets of the set { 1, 2, ..., n } and they are in some arbitrary order, that is, we have subsets S1, S2, ..., Sn, but how many and which elements are in each of these subsets ...

Question suppose you are given a turing machine m not

Question : Suppose you are given a Turing machine M (not necessarily a decider), a string w, and a (different) magic genie. You can ask the magic genie whether a certain Turing machine accepts a certain input string, and ...

The big bad wolf loves eating little pigs for breakfast

The big bad wolf loves eating little pigs for breakfast, lunch, dinner, supper, midnight snacks and he does know all about second breakfast. He tends to consume a lot of little pigs in a week. (He is probably not Jewish) ...

Question suppose you have a table employee with the

Question : Suppose you have a table, EMPLOYEE, with the following attributes: eid, work_title, fname, lname, ssn, salary, date_of_birth, and commission_rate. Ms. Smith is vice president of sales. She and three regional s ...

Part 1whats the importance of a documentation plan please

Part 1: What's the importance of a Documentation Plan? Please provide an example of a Documentation Plan that you would use. Part 2: How do you calculate how long a project will take? These questions are for my Introduct ...

Take the input of numbers and reverse the order of elements

Take the input of numbers and reverse the order of elements in that vector using recursion.

Assume that the hypothetical economy of mo has 8 workers in

Assume that the hypothetical economy of Mo has 8 workers in year 1, each working 1,500 hours per year (50 weeks at 30 hours per week). The total input of labor is 12,000 hours. Productivity (average real output per hour ...

Suppose that we have the following cities mudville horns

Suppose that we have the following cities: Mudville, Horns, Farm Town, Almira, Billows, Carmenovsk, Dantub. They are in a rural county and have no paved roads. Your county government decides to build a paved network of r ...

Systems and networkscalculate the timeoutinterval for tcp

Systems and Networks Calculate the TimeOutInterval for TCP. Assume the observed SampleRTTs for the first three packets are 2 seconds, 5 seconds, and 8 seconds. The value of a=0.25 and the "safety margin" is 0.5 seconds. ...

Research web server vulnerabilities by choosing a site and

Research web server vulnerabilities by choosing a site and determining what kind of platform it is running on. Do not scan the server, you can use a site such as Netcraft to determine what the website is running. See if ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As