联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2019-05-21 10:41

Assignment 2

Learning Outcomes

On successful completion of this assignment, students are expected to:

understand and be able to apply a variety of data structures together with their internal

representation and algorithms;

be able to select, with justification, appropriate data structures to ensure efficient

implementation of an algorithm.

To Do

Design and implement a JAVA program called ‘Library’.

Data

Your system should store books’ information. A book in your library should contain:

ISBN: ISBN is the acronym for International Standard Book Number. It is a 10 or 13-digit

number used to identify a specific book.

Title: each book has one title, but different books can have the same title.

Author: each book has one author, but different books can have the same author.

Category: each book belongs to one of these 6 categories: Arts, Business, Comics, IT,

Cooking, Sports.

How many copies in total of this book: no more than 20 copies per book.

How many copies available for lending.

Note: Different books with the same title cannot share the same author.

Functionality

Your system should provide at least 5 types of functions including: input, update, delete, display

and search book information:

Add:

a) Add a new book by providing all the information required.

Delete:

a) Delete a book by providing

The book’s ISBN

Or by providing the title together with the author name.

Note: When some copies of the book have been lent out, this book

cannot be deleted.

Search:

a) Search a book by providing an input of any kind, you method should display

everything that matches the input. Information of results books should be

displayed in a table format and displayed in a descending order based on the total

copy number of the books.

Update:

a) Find the book by ISBN and then update any information of the book (except ISBN).


Display:

a) Display all books’ information in table format. Allowing user to choose group by:

Category: display books by category.

Or author: display books by author.

Note: All your methods should provide console display of the results.

Example

The following shows a typical scenario of user interactions with the system (user commands or

inputs are rendered in italics):

Library

Welcome to the library management system, functions provided include the following:

o Add – to add a new book

o Update – to update book info

o Search – to enquire about book info

o Delete – to delete a book

o Display– to display book(s) info

o Quit – to exit from the current level of interactions

Enter your command here(Enter ‘Quit’ at any time to exit from current level): Add

o Enter a new book ISBN: 7302061866

ISBN: 7302061866 Entered.

o Enter the title: Data Structure

Title: Data Structure Entered.

o Enter the author: Michael Main

Author: Michael Main Entered.

o Enter category: IT

Category: IT Entered.

o Enter total copy number: 20

Ready to add book: 7302061866; Data Structure; Michael Main; IT;20;20

o Enter ‘Y’ to add new book. Anything else to quit: Y

New book added successfully.

o Note: automatically exit from current level.

Enter your command here(Enter ‘Quit’ at any time to exit from current level): Add

o Enter a new book ISBN: 7302061867

ISBN: 7302061867 Entered.

o Enter the title: Data Structure

Title: Data Structure Entered.

o Enter the author: Michael Main

Book Data Structure by Michael Main exists in system.

o Please re-enter Author or enter ‘T’ to re-enter title: T

o Enter the title: Data Structure II

o Enter category: IT

Category: IT Entered.

o Enter total copy number: 20


Ready to add book: 7302061867; Data Structure II; Michael Main; IT; 20; 20

o Enter ‘Y’ to add new book. Anything else to quit: Y

New book added successfully.

o Note: automatically exit from current level.

Enter your command here: (Enter ‘Quit’ at any time to exit from current level): Delete

o Enter the book’s ISBN or title + author: 7302061867

Found book:

ISBN TITLE AUTHOR CATEGORY TOTAL_COPIES AVAILABLE_COPIES

7302061867 Data Structure II Michael Main IT 20 20

o Enter ‘Y’ to delete the book. Anything else to quit: Y

Book with ISBN 7302061867 has been deleted successfully.

o Note: automatically exit from current level.

Enter your command here: (Enter ‘Quit’ at any time to exit from current level): Delete

o Enter the book’s ISBN or title + author: Data Structure + Michael Main

Found book:

ISBN TITLE AUTHOR CATEGORY TOTAL_COPIES AVAILABLE_COPIES

7302061866 Data Structure Michael Main IT 20 18

Sorry this book cannot be deleted. There are 2 copies have been lent out.

o Note: automatically exit from current level.

Enter your command here: (Enter ‘Quit’ at any time to exit from current level): Search

o Enter your keyword: Data Structure

Found book(s):

ISBN TITLE AUTHOR CATEGOR

Y

TOTAL_COPIE

S

AVAILABLE_COP

IES

7302061866 Data Structure Michael Main IT 20 18

7302061867 Data Structure II Michael Main IT 20 20

7302061000 Algorithm and Data

Structure

PAUL ERNEST IT 18 8

7303158867 Dynamic Data

Structure

DANEIL IT 10 10

7302000677 Data Structure in

JAVA

LIU IT 10 3

o Enter ‘Y’ to search other books, anything else to quit: Y

o Enter your keyword: Michael

Found book(s)

ISBN TITLE AUTHOR CATEGOR

Y

TOTAL_COPIE

S

AVAILABLE_COP

IES

7302061866 Data Structure Michael Main IT 20 18

7302061867 Data Structure II Michael Main IT 20 20

o Enter ‘Y’ to search other books, anything else to quit: 7302000677

Found book:

ISBN TITLE AUTHOR CATEGOR

Y

TOTAL_COPIE

S

AVAILABLE_COP

IES

7302000677 Data Structure in

JAVA

LIU IT 10 3

o Enter ‘Y’ to search other books, anything else to quit: Y

o Enter your keyword: Arts

Found book(s)


ISBN TITLE AUTHOR CATEGOR

Y

TOTAL_COPIE

S

AVAILABLE_COP

IES

4102061866 Interaction of color Josef Albers Arts 15 8

4102061867 Digital Arts J.D IT 14 10

o Enter ‘Y’ to search other books, anything else to quit: N

o Note: automatically exit from current level.

Enter your command here: (Enter ‘Quit’ at any time to exit from current level): Update

o Enter ISBN: 7302000677

Found book:

ISBN TITLE AUTHOR CATEGOR

Y

TOTAL_COPIE

S

AVAILABLE_COP

IES

7302000677 Data Structure in

JAVA

LIU IT 10 3

o Enter type of information you want to update, ‘T’ for title, ‘A’ for author, ‘C’ for

category, ‘TC’ for total copy number, ‘AC’ for available number: TC

o Enter your new total copy number(***with hint***): 18

Book 7302000677‘s total copy number has been updated from 10 to 18

successfully.

o Note: automatically exit from current level.

Enter your command here: (Enter ‘Quit’ at any time to exit from current level): Display

o Enter ‘C’ for displaying group by category, or ‘A’ for displaying group by author:

C

ISBN TITLE AUTHOR CATEGOR

Y

TOTAL_COPIE

S

AVAILABLE_COP

IES

7302061866 Data Structure Michael Main IT 20 18

7302061867 Data Structure II Michael Main IT 20 20

7302061000 Algorithm and Data

Structure

PAUL ERNEST IT 18 8

7303158867 Dynamic Data

Structure

DANEIL IT 10 10

7302000677 Data Structure in

JAVA

LIU IT 10 3

4102061866 Interaction of colour Josef Albers Arts 15 8

o Note: automatically exit from current level.

Notes

Capitalization makes no difference. For example ‘Add and ‘add’ can be considered as the

same.

The above scenario is just an example. It is not the standard format for your system.

Above scenario did not consider input validation, however in your system, you should

validate the inputs.

Your system must provide hints for user to understand what info to input during the

interaction.

It is up to you to decide what algorithms and data structures to use to keep track of

books info in the system, and where to find such info.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp