程序代写代做代考 gui Java database junit 2016/7/17 CSC 216: WolfLibrary

2016/7/17 CSC 216: WolfLibrary
Project 2, Part 1 WolfLibrary
Project 2 requires you to go through standard software development phases to design, implement, and test a complete Java program consisting at multiple source code files and JUnit test cases. Part 1 of Project 2 focuses on design and system tests for the project’s requirements. There are two deliverables for Part 1:
1. Design proposal and rationale that includes a UML class diagram. 2. Black box test plan.
Problem overview
Many people enjoy the convenience of eReaders like Kindles, Nooks, and iPads. But almost all of us still like the feel of books with paper rather than virtual pages. That makes us potential patrons of a new interactive book lending library system called WolfLibrary, which lends only physical books on real paper. Although it has not yet come close to amassing a credible book inventory, WolfLibrary is starting to catch the interest of venture capitalists.
WolfLibrary provides an interactive system that library patrons use to view the book inventory and select books that they are interested in, putting them into their reserve queues for eventual check out. Whenever the patron returns a checked out book, WolfLibrary automatically checks out the next available book in the patron’s reserve queue, shipping it directly to the patron. Patrons can have between 1 and 5 books checked out at a given time, depending on their account settings.
You must write a prototype for a lending library system that WolfLibrary can demonstrate to venture capitalists. The prototype system will include an administrator, patrons, and an inventory of books.
The book inventory
There is a (theoretically) unlimited number of books in the WolfLibrary inventory. Each book is identified by its title and author. There may be multiple copies of each book. Some books are in stock and ready for shipment. Others are checked out by patrons.
Information on the library book inventory is loaded from a text file on program startup. The file consists of lines representing books, where each line follows this format:

Here, is an integer and is the book title followed by the author. An example
library file might look like this:
3 Pride and Prejudice by Jane Austin
5 D Day: June 6, 1944: The Climactic Battle of World War II by Stephen E. Ambrose
1 Love in the Time of Cholera by Gabriel Garcia Marquez
0 The Elements of Style (4th Edition) by Strunk and White
For that short sample file above, there is currently only one copy in stock of “Love in the Time of Cholera.” There are no copies in stock of “The Elements of Style,” which indicates that all copies are currently checked out.
The administrator
There is a single administrator for the entire system. The administrator can login to the library system, create new patron accounts, cancel accounts, logout, and shut the system down. The administrator’s username is admin and password is also admin.
The patrons
The prototype system can have up to 20 patrons. Patrons can login, logout, browse the book inventory, put books in their reserve queues, rearrange or remove books from their reserve queues, and return books that they have checked out.
The user interface
Users access the system via a graphical user interface. The GUI has four faces that correspond to user actions:
1. Login face. For logging into the system. This face is shown at startup and whenever a user logs out of the system.
https://courses.ncsu.edu/csc216/lec/651/wrap/projects/2016-Summer/project2-part1.html 1/10

2016/7/17 CSC 216: WolfLibrary
2. Welcome face. Opens as soon as a user logs in. The face has buttons according to who is logged in:
Admin logged in: There are buttons for adding a new patron account and canceling an account. The Logout and Quit buttons at the bottom are enabled.
Patron logged in: There are Browse and Queue buttons at the top for browsing the inventory and working with books checked out and the reserve queue. The Logout button at the bottom is enabled; the Quit button is not.
The library system supports only a single user at a time. (No user can log in while another user is already
logged in.)
3. Browse face. For viewing the books in the library and selecting ones to go into reserve queues. This face is
open only to patrons.
4. Queue face. For viewing reserve queues and collections of books checked out, rearranging and removing
books from the reserve queues, and returning checked out books to the library. This face is also open only to patrons.
Buttons at the top of the application window vary according to who is logged in. The Quit button at the bottom is enabled whenever the the administrator is logged in.
Requirements use cases
Use cases are described here according to the faces on the GUI.
Login services and startup Use Case 1: Startup
Preconditions: The user starts the program.
Main Flow: The user starts the program either with a command­line argument [S1] or a file chooser [S2] for the name of the file that has inventory information. The program builds the inventory from the file [S3] and opens the Login face [S4], as illustrated on the right. Buttons for administrative actions and patron actions are initially disabled.
Subflows:
[S1] The user specifies the file as a command­ line argument [S3][E1].
[S2] If there is no command­line argument, the program displays a file chooser for file selection [E1]. [S3] An inventory of books is created by processing each line of the file as described above [E2].
[S4] The Login face opens with all buttons except Login disabled. Alternative Flows:
[E1] If the filename specified by the user does not exist or if the user cancels the file chooser, the program exits.
[E2] Any defective line in the file specified by the user is ignored.
Use Case 2: Login
https://courses.ncsu.edu/csc216/lec/651/wrap/projects/2016-Summer/project2-part1.html 2/10

2016/7/17 CSC 216: WolfLibrary
Preconditions: The program is running, the Login face is open and the Login button is enabled. All other buttons are disabled.
Main Flow: The user enters information for the username and password fields then clicks Login. The user is logged into the system [S1] and the main window shows the Welcome face [S2][S3].
Subflows:
[S1] The username/password combination is verified [S1][S2][E1].
[S2] If the username/password matches the administrator’s username and password
(admin/admin), the administrator is logged in. The Welcome face shows the enabled buttons of Add New Patron Account, Cancel Account, Quit, and Logout.
[S3] If the username/password matches a patron in the patron database, the patron is logged in. The Welcome face shows the buttons Browse, Show My Books, Logout, and Quit. The Quit button is disabled.
Alternative Flows:
[E1] The username/password pair entered by the user does not correspond to the administrator or to any patron. The system displays a dialog with the message “Account information is incorrect.”, shown below, and the user is not logged in. Buttons remain in their current enabled/disabled states.
Use Case 3: Logout
Preconditions: A user (patron or administrator) is logged in [UC2]. Any face can be open but there are no open dialog boxes.
Main Flow: The user clicks Logout [S1]. The Login face opens [S2] and the user is logged out [S3]. Subflows:
[S1] The user who is logged in is automatically logged out.
[S2] The Login face opens.
[S3] The Login button is enabled. All other buttons are disabled.
Use Case 4: Quit
Preconditions: The administrator is logged in [UC2]. The admin Welcome face is open but there are no open dialogs.
Main Flow: The administrator stops program execution [S1][S2]. Subflows:
[S1] The administrator clicks Quit.
[S2] The program stops execution without any errors.
Administrator Functionality
Use Case 5: Add new account
Preconditions: The administrator is logged in [UC2][S2]. The admin Welcome face is open but there are no open dialogs.
Main Flow: The administrator clicks Add New Patron Account. A dialog box opens for entering new patron information as shown below. The administrator enters the new username and password and selects how many books this patron can have checked out [S1][S2] or the administrator cancels the action [E4].
https://courses.ncsu.edu/csc216/lec/651/wrap/projects/2016-Summer/project2-part1.html 3/10

2016/7/17 CSC 216: WolfLibrary
Subflows:
[S1] The username/password combination is checked against the current database to make sure it is valid [E1][E2] and does not match user already in the database [E3].
[S2] The new patron is added to the database, which maintains its list of users in case­insensitive alphabetic order by user name.
Alternative Flows:
[E1] The patron database is full. A dialog box opens with the message “There is no room for additional patrons.” indicating the database has no room for additional accounts as shown below. The administrator clicks OK, and all dialog boxes close. The patron database remains unchanged.
[E2] The username or password are all whitespace, empty, or contain embedded whitespace characters. A dialog box opens with the messsage “Id and password may not contain whitespace.” indicating the username or password are not valid as shown below. This patron is not added to the database. The administrator clicks OK, and the dialog boxes close. The patron database remains unchanged.
[E3] The username matches one already in the database. A dialog box opens with the message “Patron already has an account.” indicating the patron already has an account as shown below. The administrator clicks OK, and all dialog boxes close. The patron database remains unchanged.
[E4] The administrator clicks Cancel in the New UserName and Password dialog. The dialog closes
https://courses.ncsu.edu/csc216/lec/651/wrap/projects/2016-Summer/project2-part1.html 4/10

2016/7/17 CSC 216: WolfLibrary
and the patron database remains unchanged.
Use Case 6: Cancel account
Preconditions: The administrator is logged in [UC2][S2]. The admin Welcome face is open but there are no open dialogs.
Main Flow: The administrator clicks Cancel Account. A dialog box opens as shown below. The administrator enters the username for the account to cancel and clicks OK [S1] to delete the associated patron’s account and close the dialog or Cancel to stop the action [E1].
Subflows:
[S1] The specified account is removed from the patron database [E2]. The remaining items in the patron database remain in order by username.
[S2] All books that the patron with the specific account has checked out are returned to the library inventory.
Alternative Flows:
[E1] The administrator clicks Cancel. The patron database remains unchanged.
[E2] The username entered does not match any patron in the database. A dialog opens with the message “Account information in incorrect.” to indicate the error as shown below. The administrator clicks OK, and all dialog boxes close. The patron database remains unchanged.
Browse
Use Case 7: Navigate to the Browse face
Preconditions: A patron is logged in [UC2].
Main Flow: The user (patron) clicks Browse. The Browse face opens, showing all books in the inventory in a scrollable list, as shown on the right [S1][S2].
Subflows:
[S1] Each book is displayed in the list by its title and author only. If all copies for that book are currently out of stock, the book is shown with an asterisk and blank (“* “) before its title and author. See Christine by Steven King in the snapshot to the right.
[S2] The books are listed in alphabetical order according to their info (title and author). The ordering is not case sensitive, and it ignores any initial articles “The”, “A”, and “An”.
Use Case 8: Reserve the selected book
Preconditions: A patron is logged in [UC2] and has opened the Browse face [UC7].
https://courses.ncsu.edu/csc216/lec/651/wrap/projects/2016-Summer/project2-part1.html 5/10

2016/7/17 CSC 216: WolfLibrary
Main Flow: The user (patron) selects a book from the list and clicks Reserve Selected Book [E1] to check out the book [S1] or put it in the reserve queue if the maximum number of books is already checked out [S2].
Subflows:
[S1] If a copy of the book is available and if the user has fewer than the maximum allowable number of books checked out (according to the user’s account settings) [S3]:
The selected book is added to the end of the list of books that the user checked out. (Hence a copy of the book would be mailed to the user .)
The number of copies of that book in the library is decremented by 1.
[S2] If the selected
book is not available
or if the user has the
maximum allowable number of books checked out, the selected book is added to the end of the user’s reserve queue [S3]. This does not decrement the number of books in the library.
[S3] The selected book is shown as reserved on the bottom of the window. The books on the Library Inventory list are updated as needed.
https://courses.ncsu.edu/csc216/lec/651/wrap/projects/2016-Summer/project2-part1.html 6/10

2016/7/17 CSC 216: WolfLibrary
Alternate Flows:
[E1] The user fails to select a book but clicks Reserve Selected Book. Nothing happens. Queue management
Use Case 9: Navigate to Queue face
Preconditions: A patron is logged in [UC2].
Main Flow: The user clicks Show My Books at the top of the window. The Queue face opens showing
the user’s reserve queue [S1] and list of books that the user has checked out [S2][E1].
Subflows:
[S1] The queue face shows the user’s reserve queue under My Reserve Queue. The books are displayed according to the order they were placed in the list and (possibly) subsequently moved. [S2] The books in My Checked Out Books shows all books that the user currently has checked out, listed in the order in which they were checked out.
The snapshot at the right shows the Queue face for a patron who has an upper limit of 3 books checked out. Notice that the books are shown strictly by title and author. There is no indication of whether copies for a particular book are out of stock in the inventory.
Use Case 10: Return a book to the library’s inventory
Preconditions: A patron is logged in [UC2]. The Queue face is open [UC9].
Main Flow: The user selects a book in My Checked Out Books then clicks Return Selected Book [S1] [E1].
Important: There is no restriction on queue duplicates ­­ patrons can have multiple copies of the same book both checked out and in their reserve queues.
https://courses.ncsu.edu/csc216/lec/651/wrap/projects/2016-Summer/project2-part1.html 7/10

2016/7/17 CSC 216: WolfLibrary
Subflows:
[S1] The selected book is removed from My Checked Out Books [S2].
[S2] The number of copies of that book in the library inventory is incremented by 1 [S3].
[S3] The available book closest to the front of My Reserve Queue is moved from there to the bottom of My Checked Out Books [S4][E2].
[S4] The number of copies of the book from [S3] is decremented in the library by 1.
[S5] The Queue face shows the updated lists.
Alternate Flows:
[E1] The user fails to select a book and clicks Return Selected Book. Nothing happens.
[E2] If there are no available books in the reserve queue following [S3], then there are no subsequent changes to any lists.
Use Case 11: Remove a book from the reserve queue
Preconditions: A patron is logged in [UC2]. The Queue face is open [UC10].
Main Flow: The user selects a book in the My Reserve Queue then clicks Remove Selected Book [S1]
[E1].
Subflows:
[S1] The selected book is removed from My Reserve Queue [S2].
[S2] The Queue face shows the updated lists.
Alternate Flows:
[E1] The user fails to select a book and clicks Remove Selected Book. Nothing happens.
Use Case 12: Move the selected book in the reserve queue up one position.
Preconditions: A patron is logged in [UC2]. The Queue face is open [UC10].
Main Flow: The user selects a book in My Reserve Queue then clicks Move Selected Book Up [S1][E1]. Subflows:
[S1] The selected book is moved up one position in My Reserve Queue[S2].
[S2] The Queue face shows the re­ordered list.
Alternate Flows:
[E1] The user fails to select a book and clicks Move Selected Book Up. Nothing happens.
Design
For Part 1 of this assignment, you must create a design proposal containing a design rationale and a UML class
https://courses.ncsu.edu/csc216/lec/651/wrap/projects/2016-Summer/project2-part1.html 8/10

2016/7/17 CSC 216: WolfLibrary
diagram.
Your design must:
utilize the Model­View­Controller (MVC) design pattern contain a GUI (no need to show all its members) contain at least one interface
contain at least one composition relationship
You should answer the following technical questions in your design document as part of the rationale:
1. Have you identified the objects important to the system’s implementation and how do you know they are important?
2. Have you identified all data required to implement the system and how do you know these data are needed?
3. Are the responsibilities assigned to an object appropriate for that object’s abstraction and why?
4. Have you identified the relationships between objects (i.e. inheritance or composition) and described why
those relationships are important?
5. Have you identified any design patterns appropriate for implementing the system? How are the identified
patterns appropriate for implementing the system?
6. What are the limitations of your design? What are the constraints of your system?
When thinking about the relationships between your UI and the model, consider these questions:
1. What are the data and behaviors of your model that will be shown through the UI?
2. How does your UI get those data to display; what methods of the model must be called?
Submitting your work
You must submit your design proposal via your section’s submission platform as a PDF. Use the provided design proposal template as a starting point for your design proposal. Use a UML diagramming tool, like Dia, to create your UML diagram. You may also hand draw your UML diagram. In either case you submit your UML diagram (either scan it in or create an electronic image of it) along with your design proposal for credit. Make sure that your electronic diagram is readable! Name your design proposal document DesignProposal_P2P1_unityid.pdf, where unityid is your unity id. If you have a separate file for your UML diagram, name the file DesignUML_P2P1_unityid.*, where * is the extension of your diagram file. pdf/gif/jpg/png are accepted file formats.
For more direction, see the following example design proposal: Sample Design Proposal.
Implementation
Implementation details will be available for the second part of this project.
Testing
This project requires that you do white box and black box testing. You can defer white box testing until after you write some code. But now, you need to prepare some black box test cases.
Assignment
You will write at least three (3) tests for the WolfLibrary project. Use the provided black box test plan template to describe your tests. Each test must be repeatable and specific; all input and expected results values must be concrete. All inputs required to complete the test must be specified. Additionally, you must provide instructions for how a tester would set up, start, and run the application for testing. (What class from your design contains the main method that starts your program? What are the command line arguments, if any? What do the input files contain?) The instructions should be described at a level where anyone using Eclipse could run your tests.
To help simplify your tests, we recommend that you include the following information about setting up the tests. This information includes a short book inventory file and the initial creation of two patrons, one of which has books checked out and a populated reserve queue. The other patron has no books checked out or in reserve.
Library Inventory
3 Pride and Prejudice by Jane Austin
5 D Day: The Climactic Battle of World War II by Stephen E. Ambrose
1 Love in the Time of Cholera by Gabriel Garcia Marquez
0 The Elements of Style (4th Edition) by Strunk and White
Patron 1
patron1@ncsu.edu, pw1, 3
Checked Out: The Elements of Style, D Day, Love in the Time of Cholera Reserve Queue: D Day, Love in the Time of Cholera
https://courses.ncsu.edu/csc216/lec/651/wrap/projects/2016-Summer/project2-part1.html 9/10

2016/7/17 CSC 216: WolfLibrary
Each test should consider a different scenario through the system. There are many scenarios for this project, so there should be no difficulty considering different paths of functionality. You will be evaluated on how well your test models a scenario through the system and the variety of your tests. One way to think about a scenario is to consider a path through one ore more use cases.
Format
You must submit your black box test plan via your section’s submission platform as a PDF. Use the provided template as a starting point for your black box test plan. Name your black box test plan document BBTP_P2P1_unityid.pdf, where unityid is your unity id. For more help, see the example black box test plan: Sample Black Box Test Plan.
Deployment
For this class, deployment means submitting your work for grading. For Part 1 of this programming assignment, you must submit two documents:
1. Design document (pdf). Name your design proposal document DesignProposal_P2P1_unityID.pdf, where unityID is your unity id. The design document should include your UML class diagram.
2. Black box test plan document (pdf). Your black box test plan document must be named BBTP_P2P1_unityID.pdf, where unityID is your unity id.
Make sure your submissions satisfies the grading rubric for this project. Note, there are deductions for misnamed files or files that are in the wrong format.
You should submit the documents for Project 2 Part 1 to your section’s submission system. The name of the assignment is WolfLibrary.
The electronic submission deadline is precise. Do not be late. You should count on last minute system failures (your failures, ISP failures, or NCSU failures).
Patron 2
patron2@ncsu.edu, pw2, 2 Checked Out:
Reserve Queue:
https://courses.ncsu.edu/csc216/lec/651/wrap/projects/2016-Summer/project2-part1.html 10/10