程序代写代做代考 go data structure html 12.26 ZyProject: Irma Pince’s Library Management System

12.26 ZyProject: Irma Pince’s Library Management System
While we do our best to make our projects error-free, since we don’t reuse projects, errors can get past the review process. Please notify the staff of any errors/inconsistencies you see in the specification. We will work quickly to resolve any issues as soon as possible.
EXTRA CREDIT ADDED: for Penalty Report Function. Please see Stage4 for details.
Another tool you might find useful to compare expected & actual output: https://www.diffchecker.com/
**IF YOU ARE NOT COMPLETING THE ZYPROJECT, DO NOT SUBMIT OR TEST CODE IN THIS PROJECT **. Otherwise ZyBooks will report your score as a 0 for the project.
This ZyProject is designed to test you on everything you have learned, and designed to test all concepts you’ve learned so far.
Each succeeding stage is built upon what you have already written for the previous stage. We expect you to design, write, and test this program according to these stages—first get the first-stage program working, then modify it to satisfy the second stage, and so on. You should make sure that each stage is entirely correct and working perfectly before you go on to the next. As you complete each stage, you should check that you passed the relevant test cases before you go on to the following stage.
Development by stages is good software engineering practice. It is far better to have a program that is correct but incomplete (i.e., it doesn’t implement all the features but what it does implement is correct) than one that contains bugs.
Statement of the problem
 Madam Irma Pince is the Librarian for the Hogwarts School of Witchcraft & Wizardry.
You are being asked to code a library inventory system to support the various functions/duties of the librarian.
The Hogwarts librarian has many duties, including:
Paperwork:
• Establishing library rules, regulations, policies and procedures.
• Preparing the library due date sheets and maintaining overdue records.
• Prepare and manage the library budgets, circulation files, statistics and inventories.
• Classify, and catalogue library books in order to properly making them ready for checkout.
Practical work:
• Monitoring the Library, as well as keeping it organized, clean and neat.
• Assisting students and staff members in finding the desired reading material.
• Implementing and enforcing library rules, regulations, policies and procedures.
• Placing spells on the books aimed at protecting them from mistreatment or theft.
• Checking the authenticity of the written permissions slips for the Restricted Section.
• Making sure all students have left the library by 8:00 pm, at which time the library closes.
• Overseeing the Study Hall and helping students with academic research and/or homework.
• Undertaking any other reasonable duty at the request of the Headmaster/Headmistress of Hogwarts.
Your program will keep track of the library’s inventory.
Each test case will be run with a given file. You will need to read the given file and implement the contents based on the directions given for each stage.

Technical Details
• Everything in Stage I goes into main.py
• Take a command line argument which is the filename, which is the command script, in your main statement. Do NOT take input! Read the file with the given filename.
• Create a function called hogwarts_library() which takes one input argument which is a string representing all the contents of command script.
• Process the string line-by-line (Hint: split by newline character)
• Create a variable (in modular scope) named “book_collection”, as a dictionary with the key being a string, book_title, and the value a Book nametuple instance.
• Create a function command_nb() which takes in one single line of command (a string) starting with “NB” and process accordingly
• Create a function command_li() which takes in one single line of command (a string) starting with “LI” and process accordingly
• Create a function command_db() which takes in one single line of command (a string) starting with “DB” and process accordingly
• Create a function command_fb() which takes in one single line of command (a string) starting with “FB” and process accordingly
• Create a function command_as() which takes in one single line of command (a string) starting with “AS” and process accordingly
• Create a function command_lm() which takes in one single line of command (a string) starting with “LM” and process accordingly
• Create a function command_pl() which takes in one single line of command (a string) starting with “PL” and process accordingly
• In hogwarts_library(), call one of the command_* functions whenever a newline in command script is stepped onto
• Add functions using the format/pattern above for other commands as needed in each stage
• Don’t be afraid to think outside the box.
Hints and Suggestions
It is recommended to program this assignment using debugging tools found in Python Tutor or in your favorite IDE such as OnlineGDB, IDLE, Visual Studio, PyCharm and etc. These tools help you debug and refactor your program. ZyBooks is not intended for larger scale in-browser Python development, but you of course are welcome to just use ZyBooks.
One of the early questions to ask when designing a program is what data structure(s) you should use to represent the main information in the program. Making decisions like this becomes easier with practice, but there are two things to keep in mind. First, start with the simplest data structure that does the job. (For the collection of bedrooms in this stage, maybe a list of integer room numbers is good enough, or maybe a set of room numbers.)
Second, accept that your first choice may not be your final choice; as the specifications become clearer or as circumstances change (or as you get to later stages in a problem like this one), you may decide that something else would work better.
This kind of revision is a normal part of programming. It’s no tragedy to rewrite some code in a better way, just as you should expect to revise natural-language documents. (For the books in this problem, we might decide to use a dictionary whose key is the book title and whose value is a namedtuple of book information. But we shouldn’t necessarily jump to this arrangement until we’re sure it helps us, but it isn’t a bad idea…)
Lastly, READ ALL THE WAY TO THE BOTTOM of this specification before you get started.
Don’t give up! The lab is long, but if you follow the hints, use good data structures, break things down step by step, and think ahead it is not difficult!

Stage I
For this stage, your program will keep track of the rooms that are available. This stage implements four commands, as described below. On each command line, the first two non-whitespace characters are the command; command letters may be upper or lower case.
• NB (for “Add a New Book”) followed by a comma separated list of fields: title=Title,author=Author,year_published=####,subject=Subject, section=Restricted Add a new book with the specified information. To keep the project simple, we only allow one copy of a book to present in the library.
• LI (for “List Inventory”). Print a list of all books owned/maintained by the library sorted by title.
• DB (for “Delete Book”) followed by a title=Title. Print the message, “Book Not Found. Cannot be deleted.” if the specified book isn’t present in the library. NOTE: You will update this function again in Stages II & III.
• FB (for “Find Books”) followed by 0 or more of the following search criteria: title=Title,author=Author,year_published=####,subject=Subject,section=Section. Print a list of books, sorted by title, that are owned/maintained by the library that meet the provided criteria. If 0 criteria is provided, then print all books. If no books are found matching the criteria provided, print the message, “No Books Found.”
• AS (for “Add Student”) followed by the following fields: student_name=Student Name, house_name=House. Add the student to library members. If the student is already present, print “Student Name is already present.”
• LM (for “List Members”) prints members according to each house, sorted by house and member name. If no members of a house are registered, print “No Registered Members”.
• PL (for “Print Line”), followed by any text. Simply print (or “echo”) a line, copying the input (not counting the PL and leading whitespace) to the output. You’ll find it useful in testing, and it’s also a simple way to make the program’s reports clearer or fancier.
• ** Comment, followed by any text. Like comments in a program, comment lines don’t have any effect on the program’s behavior; they just serve as annotations in the command file.
The input file may contain any number of these commands in any order. See the sample output below for the format of the printed books list.
Below is a sample command script for this stage(also in Stage1Commands.txt).
** This is a sample command file for the Hogwarts Library, Stage I
PL ***********************************************************
PL Here is a list of available books (before adding any!)
** A well-written program works gracefully with empty structures.
PL ** List Inventory when there are no books
LI
PL
PL ** Now let’s add a book:
NB title=Curses and Counter-Curses,author=Vindictus Viridian,year_published=1703,subject=Curses,section=Restricted

PL ** List Inventory when there is 1 book
LI
PL
** And some more:
** Extra blanks around the command should be ignored
Nb title=Winogrand’s Wondrous Water Plants,author=Selina Sapworthy,year_published=1970,subject=Water plants,section=Non-Restricted
PL Try adding a book that is already in inventory
Nb title=Winogrand’s Wondrous Water Plants,author=Selina Sapworthy,year_published=1970,subject=Water plants,section=Non-Restricted
PL
NB title=Ancient Runes Made Easy,author=Laurenzoo,year_published=1992,subject=Ancient Runes,section=Non-Restricted

PL ** List Inventory when there are multiple books
LI
PL
PL ** Test deleting a book from the book collection
DB title=Winogrand’s Wondrous Water Plants
PL ** Test Find Book with a single search parameter
FB section=Restricted
PL

** Add Students to Library Members
AS student_name=Draco Malfoy,house=Slytherin
AS student_name=Hermione Granger,house=Gryffindor
AS student_name=Harry Potter,house=Gryffindor
AS student_name=Luna Lovegood,house=Ravenclaw

PL ** List Current Library Members
LM
PL

PL Thank you for using the Hogwarts Library Management System!
** That’s the end of the sample data for Stage I.
From this input file, your program should produce the following output:
***********************************************************
Here is a list of available books (before adding any!)
** List Inventory when there are no books
*********************LIBRARY INVENTORY**********************
Number of books available: 0
————————————

** Now let’s add a book:
** List Inventory when there is 1 book
*********************LIBRARY INVENTORY**********************
Number of books available: 1
————————————
Title: Curses and Counter-Curses
Author: Vindictus Viridian
Date: 1703
Subject: Curses
Section: Restricted
————————————

Try adding a book that is already in inventory
Winogrand’s Wondrous Water Plants already present.

** List Inventory when there are multiple books
*********************LIBRARY INVENTORY**********************
Number of books available: 3
————————————
Title: Ancient Runes Made Easy
Author: Laurenzoo
Date: 1992
Subject: Ancient Runes
Section: Non-Restricted
————————————
Title: Curses and Counter-Curses
Author: Vindictus Viridian
Date: 1703
Subject: Curses
Section: Restricted
————————————
Title: Winogrand’s Wondrous Water Plants
Author: Selina Sapworthy
Date: 1970
Subject: Water plants
Section: Non-Restricted
————————————

** Test deleting a book from the book collection
** Test Find Book with a single search parameter
************************BOOK SEARCH*************************
Number of books found: 1
————————————
Title: Curses and Counter-Curses
Author: Vindictus Viridian
Date: 1703
Subject: Curses
Section: Restricted
————————————

** List Current Library Members
**********************LIBRARY MEMBERS***********************
Gryffindor:
Harry Potter
Hermione Granger
Hufflepuff:
No Registered Members
Ravenclaw:
Luna Lovegood
Slytherin:
Draco Malfoy

Thank you for using the Hogwarts Library Management System!

Stage II
Each stage of this assignment will continue to handle all the commands of the previous stages, of course. For this stage, your program will handle student requests, and deletions from the list of available books.
• SD (for “Start Date”) followed by a date in the following format, mm/dd/yyyy, which sets the library’s current date to the date listed. The current date will serve as the basis for reports, calculating penalties, etc…
• CB (for “Checkout Book”) followed by the following fields: title=Title, the student’s name: student_name=Student Name, then an optional number_of_days=from 1 to 14 and pass_code=PassCode for books that are Restricted. If number_of_days are not specified, then the default checkout period is 2 weeks. Your program will keep track of all the checkouts. Create a new checkout record for the specified book, and calculate a due_date.
NOTE: valid pass codes to checkout books in the Restricted section are “Accio”, and “Protego”.
• CR (for “Checkout Report”) prints all the books checked out. List checked out books with title, the name of their current borrower, and their due date. Report of books checked out needs to be organized by each school name sorted alphabetically, then each student name sorted alphabetically, and each book title sorted alphabetically. NOTE that field widths may cause book titles to be truncated in this report. Field-widths can be found in the format_string section of the file, utilities.py.
• LA (for “List Available”) print books, sorted by title, that are available to be checked out from the library inventory.
• DT (for “Due Today”) prints all the book titles & student names for books due on the current date. The report should print the the information by titles in sorted order. NOTE that field widths may cause book titles to be truncated in this report. Field-widths can be found in the format_string section of the file, utilities.py.
• AD (for “Advance Date”) advances the current library date by one day. NOTE: You will update this in Stage III.
• Update command_db() to ensure that any checkout records/information associated with a deleted book are also removed/updated.
To make your coding task easier, import the Python library datetime and use it for date calculations. It’s harder than you might think to get calculations about dates (e.g., how many days from date A to date B?) correct. The library will do it for you at the low cost of reading the documentation to see how it works. The split function with a “/” argument will be helpful, too.
Here is some sample input for this stage:
** This is a sample command file for the Hogwarts Library, Stage II
** Add Books to Library inventory
NB title=Hogwarts a History,author=Bathilda Bagshot,year_published=1947,subject=Historical,section=Non-Restricted
Nb title=Winogrand’s Wondrous Water Plants,author=Selina Sapworthy,year_published=1970,subject=Water plants,section=Non-Restricted
NB title=Ancient Runes Made Easy,author=Laurenzoo,year_published=1992,subject=Ancient Runes,section=Non-Restricted
NB title=Magick Moste Evile,author=Godelot,year_published=1300,subject=Dark Arts,section=Restricted
NB title=Secrets of the Darkest Art,author=Owle Bullock,year_published=1943,subject=Dark Arts,section=Restricted
NB title=Fifteenth-Century Fiends,author=Unknown,year_published=1991,subject=Fiends,section=Non-Restricted
NB title=Basic Hexes for the Busy and Vexed,author=Unknown,year_published=1994,subject=Hexes,section=Non-Restricted

** Add Students to Library Members
AS student_name=Draco Malfoy,house=Slytherin
AS student_name=Hermione Granger,house=Gryffindor
AS student_name=Harry Potter,house=Gryffindor
AS student_name=Luna Lovegood,house=Ravenclaw

** Set Current Date
SD 12 / 09 / 2020

PL ** Test Checking Out Books

PL **** Successful Checkout: Optional number_of_days Present
CB title=Fifteenth-Century Fiends,student_name=Harry Potter,number_of_days=2
CB title=Winogrand’s Wondrous Water Plants,student_name=Hermione Granger,number_of_days=4

PL **** Successful Checkout:Optional number_of_days Not Present
CB title=Ancient Runes Made Easy,student_name=Draco Malfoy

PL **** Checkout a Restricted Title

PL ****** Checkout a Restricted Title: with a Valid Pass Code
CB title=Secrets of the Darkest Art,student_name=Hermione Granger,pass_code=Accio
cb title=Magick Moste Evile,student_name=Draco Malfoy,pass_code=Protego,number_of_days=1

PL ** Test Check Out Reports
** Checkout Report
CR
PL

PL **** List books available to be Checked Out
LA

PL ** Test Due Today Report & Advance Date Function
DT
PL

** Advance the Current Date
AD
** Due Today Report
DT
PL
AD
DT
PL
AD
DT
PL

PL Thank you for using the Hogwarts Library Management System!
** That’ s the end of the sample data for Stage II.
For the above input, your program should produce the following output:
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
****************Wednesday 09, December 2020*****************
** Test Checking Out Books
**** Successful Checkout: Optional number_of_days Present
**** Successful Checkout:Optional number_of_days Not Present
**** Checkout a Restricted Title
****** Checkout a Restricted Title: with a Valid Pass Code
** Test Check Out Reports
***CURRENT CHECKOUT REPORT**************12/09/2020**********
Book Title Student Name Due Date
————————————————————
Fifteenth-Century Fiends Harry Potter 12/11/2020
Secrets of the Darkest Art Hermione Granger 12/23/2020
Winogrand’s Wondrous Water Pla Hermione Granger 12/13/2020
Ancient Runes Made Easy Draco Malfoy 12/23/2020
Magick Moste Evile Draco Malfoy 12/10/2020

**** List books available to be Checked Out
Number of books in available: 2
————————————
Title: Basic Hexes for the Busy and Vexed
Author: Unknown
Date: 1994
Subject: Hexes
Section: Non-Restricted
————————————
Title: Hogwarts a History
Author: Bathilda Bagshot
Date: 1947
Subject: Historical
Section: Non-Restricted
————————————
** Test Due Today Report & Advance Date Function
*******BOOKS DUE TODAY******************12/09/2020**********
No books due today.

*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
*****************Thursday 10, December 2020*****************
*******BOOKS DUE TODAY******************12/10/2020**********
Magick Moste Evile Draco Malfoy

*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
******************Friday 11, December 2020******************
*******BOOKS DUE TODAY******************12/11/2020**********
Fifteenth-Century Fiends Harry Potter

*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
*****************Saturday 12, December 2020*****************
*******BOOKS DUE TODAY******************12/12/2020**********
No books due today.

Thank you for using the Hogwarts Library Management System!

Stage III
For this stage, your program will allow library members to request holds on books that are currently checked out. The first new command for this stage adds a hold request:
• RH (for “Request Hold”) followed by the following fields: title=Title, and the student’s name: student_name=Student Name, then an optional number_of_days=from 1 to 14. If number_of_days are not specified, then the default checkout period is 2 weeks. Add a new hold record for the specified book.
Also handle these commands:
• HR (for “Hold Requests Report”). Lists all hold requests for a given book. Print sorted by title, then the student name & number of days for each request in their position of request. Print “No Holds Requested.” when there are no holds for the entire library. NOTE that field widths may cause book titles to be truncated in this report. Field-widths can be found in the format_strings section of the file, utilities.py. If any information is missing, or the book is either not present in inventory, checkout, etc, print “Invalid Hold Request for title.”
• RB (for “Return Book”), followed by the book title, title=Title. Updates checkout records & print an error message if the specified book isn’t found in inventory. An automatic checkout record should be generated for the first student who has a hold request placed for this title. If any information is missing, or the book is either not present in inventory, checkout, etc, print “Invalid Return Request for title.”
• OR (for “Overdue Report”) prints all the book titles, student names, and days past due. The report should print the information with titles in sorted order, or “No books overdue today.” when the library has no books that are overdue. NOTE that field widths may cause book titles to be truncated in this report. Field-widths can be found in the format_strings section of the file, utilities.py.
• Update command_ad() to assess house late penalties each time the current date advances.
• Update command_db() to remove any holds associated with this book when the book is deleted.
It’s a common temptation to use an elaborate test case like this one as the first test of your newly modified program. It’s all right to indulge that temptation once, if you must; of course, your test will fail. Newly modified programs always have bugs. At that point, however, you should try a succession of smaller, more circumscribed tests, rather than ramming this same large test through the program over and over again until you finally force it through successfully. It’s more productive, more thorough, and better organized in the long run to test each feature separately before going on to complex combinations. By the same token, however, adequate testing involves more than this single combination test case; this one case does not test everything that needs testing for this stage.
NOTE: Commands to create books & students, set the date, and checkout books are not shown, but are present in Stage3Commands.txt
** This is a sample command file for the Hogwarts Library, Stage III
** Add Books to Library inventory from Stage II Commands
** Add Students to Library Members from Stage II Commands
** Set Current Date from Stage II Commands
** Checkout Books from Stage II Commands

PL ** Test Requesting a Book Hold
RH title=Ancient Runes Made Easy,student_name=Luna Lovegood,number_of_days=1
RH title=Ancient Runes Made Easy,student_name=Hermione Granger,number_of_days=1
RH title=Winogrand’s Wondrous Water Plants,student_name=Luna Lovegood,number_of_days=1
RH title=Winogrand’s Wondrous Water Plants,student_name=Draco Malfoy,number_of_days=1

PL ** Test Requesting a Book Hold for a book that is available
RH title=Hogwarts a History,student_name=Draco Malfoy

PL ** Testing Book Hold Report
HR
PL

PL ** Testing Return Book
PL **** Test Returning a Book without a hold
RB title=Fifteenth-Century Fiends
PL **** Test Returning a Book with a hold creates new checkout
PL for first student with hold
RB title=Ancient Runes Made Easy
** Checkout Report
CR
** Hold Report
HR
PL

PL ** Testing Delete Book
PL **** Test Deleting a Book that is checked out & has holds
DB title=Ancient Runes Made Easy
** Checkout Report
CR
** Hold Report
HR
PL

PL ** Test Overdue Report Before Any Books are Overdue
OR
PL

PL ** Advancing Date to test Overdue Report
AD
AD
AD
AD
PL

PL ** Test Overdue Report Now that Books are Overdue
OR
PL

PL Thank you for using the Hogwarts Library Management System!
** That’s the end of the sample data for Stage III.
The sample input above should produce results as shown below:
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
****************Wednesday 09, December 2020*****************
** Test Requesting a Book Hold
** Test Requesting a Book Hold for a book that is available
Hogwarts a History is available to be checked out. Use command to checkout book.
** Testing Book Hold Report
*****HOLD REQUEST REPORT****************12/09/2020**********
Student Name # of Days Requested
————————————————————
Ancient Runes Made Easy
Luna Lovegood 1
Hermione Granger 1
————————————————————
Winogrand’s Wondrous Water Plants
Luna Lovegood 1
Draco Malfoy 1
————————————————————

** Testing Return Book
**** Test Returning a Book without a hold
**** Test Returning a Book with a hold creates new checkout
for first student with hold
***CURRENT CHECKOUT REPORT**************12/09/2020**********
Book Title Student Name Due Date
————————————————————
Secrets of the Darkest Art Hermione Granger 12/23/2020
Winogrand’s Wondrous Water Pla Hermione Granger 12/13/2020
Ancient Runes Made Easy Luna Lovegood 12/10/2020
Magick Moste Evile Draco Malfoy 12/10/2020
*****HOLD REQUEST REPORT****************12/09/2020**********
Student Name # of Days Requested
————————————————————
Ancient Runes Made Easy
Hermione Granger 1
————————————————————
Winogrand’s Wondrous Water Plants
Luna Lovegood 1
Draco Malfoy 1
————————————————————

** Testing Delete Book
**** Test Deleting a Book that is checked out & has holds
***CURRENT CHECKOUT REPORT**************12/09/2020**********
Book Title Student Name Due Date
————————————————————
Secrets of the Darkest Art Hermione Granger 12/23/2020
Winogrand’s Wondrous Water Pla Hermione Granger 12/13/2020
Magick Moste Evile Draco Malfoy 12/10/2020
*****HOLD REQUEST REPORT****************12/09/2020**********
Student Name # of Days Requested
————————————————————
Winogrand’s Wondrous Water Plants
Luna Lovegood 1
Draco Malfoy 1
————————————————————

** Test Overdue Report Before Any Books are Overdue
********OVERDUE REPORT*************12/09/2020*******# Days**
No books overdue today.

** Advancing Date to test Overdue Report
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
*****************Thursday 10, December 2020*****************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
******************Friday 11, December 2020******************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
*****************Saturday 12, December 2020*****************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
******************Sunday 13, December 2020******************

** Test Overdue Report Now that Books are Overdue
********OVERDUE REPORT*************12/13/2020*******# Days**
Magick Moste Evile Draco Malfoy 3

Thank you for using the Hogwarts Library Management System!

Stage IV
In this stage, your program will check each command for various inconsistencies and impossible situations.
First, your program should reject any checkout requests:
• for a student: ** that isn’t a library member.
• for a book: ** that has already been checked out. ** that is not present in the book collection. ** that is restricted, and a passcode has not been provided or is incorrect.
For hold requests, your program should reject hold requests that are:
• made by a student who already has a hold request
• made by a student who isn’t a registered library member
Your program must also handle deleting a book that doesn’t exist, and correctly handling penalty calculations for books that are more than 6-days over due.
PR (for “Penalty Report”) prints the point deductions for each house, sorted by house name. Then prints the penalties for individual students of that house, sorted by student name. You can assume that a student will only have one curse applied at a given time; the most severe penalty will prevail. This is an extra credit command & tested in Test Case 47.
Here is some sample input for this stage:
NOTE: Commands to create books & students, set the date, and checkout books are not shown, but are present in Stage4Commands.txt
** This is a sample command file for the Hogwarts Library, Stage IV
** Add Books to Library inventory from Stage II Commands
** Add Students to Library Members from Stage II Commands
** Set Current Date from Stage II Commands
** Checkout Books from Stage II Commands

PL **** Additional Tests: Check Out
PL **** Try checking out a book that has already been checked out
CB title=Fifteenth-Century Fiends,student_name=Harry Potter,number_of_days=2

PL **** Book Not Found
CB title=Basic Hexes for the Busy and Vexed,student_name=Hermione Granger,number_of_days=2

PL **** Student Not Found
CB title=Winogrand ‘s Wondrous Water Plants,student_name=Luna Lovegood,number_of_days=2

PL ****** Checkout a Restricted Title: No Pass Code
CB title=Secrets of the Darkest Art,student_name=Hermione Granger

PL ****** Checkout a Restricted Title: Invalid Pass Code
CB title=Secrets of the Darkest Art,student_name=Hermione Granger,pass_code=NoAccess
PL

PL **** Additional Tests: Hold Requests

PL ** Test Requesting a Book Hold a student currently has checked out
RH title=Ancient Runes Made Easy,student_name=Draco Malfoy
PL

PL ** Test Requesting a Book Hold for a book a student who already has a hold
RH title=Ancient Runes Made Easy,student_name=Luna Lovegood,number_of_days=3
PL

PL **** Test Deleting a Book that doesn’t exist
DB title=A Wizard’s Guide to the Dark Web
PL

RB title=Basic Hexes for the Busy and Vexed

PL ** Advancing Date to >6 days Overdue Report
AD
AD
AD
AD
AD
AD
AD
PL

PL ** Overdue Report
OR
PL
PL

PL Thank you for using the Hogwarts Library Management System!
** That’s the end of the sample data for Stage IV.
The sample input above should produce results as shown below:
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
****************Wednesday 09, December 2020*****************
**** Additional Tests: Check Out
**** Try checking out a book that has already been checked out
Fifteenth-Century Fiends is currently unavailable to be checked out.
**** Book Not Found
**** Student Not Found
Winogrand ‘s Wondrous Water Plants not in inventory.
****** Checkout a Restricted Title: No Pass Code
Secrets of the Darkest Art is currently unavailable to be checked out.
****** Checkout a Restricted Title: Invalid Pass Code
Secrets of the Darkest Art is currently unavailable to be checked out.

**** Additional Tests: Hold Requests
** Test Requesting a Book Hold a student currently has checked out
Draco Malfoy currently has checked out Ancient Runes Made Easy.

** Test Requesting a Book Hold for a book a student who already has a hold
Luna Lovegood has already requested a hold for Ancient Runes Made Easy.

**** Test Deleting a Book that doesn’t exist
A Wizard’s Guide to the Dark Web Not Found. Cannot be deleted.

** Advancing Date to >6 days Overdue Report
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
*****************Thursday 10, December 2020*****************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
******************Friday 11, December 2020******************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
*****************Saturday 12, December 2020*****************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
******************Sunday 13, December 2020******************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
******************Monday 14, December 2020******************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
*****************Tuesday 15, December 2020******************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
****************Wednesday 16, December 2020*****************

** Overdue Report
********OVERDUE REPORT*************12/16/2020*******# Days**
Fifteenth-Century Fiends Harry Potter 5
Magick Moste Evile Draco Malfoy 6
Winogrand’s Wondrous Water Plants Hermione Grange 3

Thank you for using the Hogwarts Library Management System!

Stage V: For this stage, your program will produce various information listings.
• UR (for “User Report”) followed by the student name, student_name=Student Name. Print the user’s curse, the books currently checked out(sorted by title) & their overdue status, followed by hold requests sorted by book title. If the user has no books checked out, print “No checkouts.”, of if the user has no books on hold, print “No holds.”
• DR (for “List All Books Due Between Two Dates”) followed by a start date & end date in the following format, start_date=mm/dd/yyyy,end_date=mm/dd/yyyy. Print the book title & student name, sorted by title, of all books due between the given dates. If none are due for the given dates or the dates are invalid, print “No books due for the given dates.”
Here is some sample input for this stage:
NOTE: Commands to create books & students, set the date, and checkout books are not shown, but are present in Stage5Commands.txt
** This is a sample command file for the Hogwarts Library, Stage V
** Add Books to Library inventory from Stage II Commands
** Add Students to Library Members from Stage II Commands
** Set Current Date from Stage II Commands
** Checkout Books from Stage II Commands
** Requesting Book Holds from Stage III Commands

PL ** Advancing Date to test Overdue Report
AD
AD
AD
AD
PL

PL ** Testing a User Report
UR student_name=Hermione Granger
PL

PL ** Testing a Due Between Report
DR start_date=01/01/1982,end_date=01/02/1982
PL

DR start_date=12/02/2020,end_date=12/10/2020
PL

PL ** Testing a Due Between Report where the Start Date is AFTER the End Date
DR start_date=01/02/1983,end_date=01/01/1982
PL
PL

PL ** Testing a User Report for a Non-Library Member
UR student_name=Ron Weasley
PL

PL Thank you for using the Hogwarts Library Management System!
** That’s the end of the sample data for Stage V.
The sample input above should produce results as shown below:
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
****************Wednesday 09, December 2020*****************
** Advancing Date to test Overdue Report
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
*****************Thursday 10, December 2020*****************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
******************Friday 11, December 2020******************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
*****************Saturday 12, December 2020*****************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
******************Sunday 13, December 2020******************
*************HOGWARTS LIBRARY MANAGEMENT SYSTEM*************
******************Monday 14, December 2020******************

** Testing a User Report
***************USER REPORT for Hermione Granger**************
Hermione Granger Curse: Ear-Shrivelling
————————-CHECKOUTS————————–
Secrets of the Darkest Art 12/23/2020
Winogrand’s Wondrous Water Plants 12/13/2020
—————————HOLDS—————————-
Ancient Runes Made Easy 1

** Testing a Due Between Report
***BOOKS DUE BETWEEN********01/01/1982 to 01/02/1982********
No books due for the given dates.

***BOOKS DUE BETWEEN********12/02/2020 to 12/10/2020********
Magick Moste Evile Draco Malfoy

** Testing a Due Between Report where the Start Date is AFTER the End Date
***BOOKS DUE BETWEEN********01/02/1983 to 01/01/1982********
No books due for the given dates.

** Testing a User Report for a Non-Library Member
Ron Weasley is not a registered member of the library.

Thank you for using the Hogwarts Library Management System!

Sample Library Structures:
You may, or may not find the following structures helpful. Feel free to use any of the definitions below:
Book
• title: str
• author: str
• year_published: int
• subject: str
• section: Non-Restricted, Restricted(Requires a pass code)
Book = namedtuple(‘Book’, ‘title author year_published subject section’)
curses = Book(“Curses and Counter-Curses”, “Vindictus Viridian”, 1703, “Curses”, “Restricted”)
Student Stores information about a student/library member
• name: string
• checked_out_books: [Book]
• house: “Gryffindor”, “Hufflepuff”, “Slytherin”, or “Ravenclaw”
Student = namedtuple(‘Student’, ‘student_name house checked_out_books’)
harry_potter = Student(“Harry Potter”, [curses], “Gryffindor”)
Checkout Record Stores information about a book that has been checked out
• book: Book
• member: Student
• due_date: datetime.date
See the following for more documentation on datetime: https://docs.python.org/3/library/datetime.html#datetime.datetime
Checkout = namedtuple(‘Checkout’, ‘book student due_date’)
curse_checkout = Checkout(curses, harry_potter, datetime.date(year=1991, month=9, day=3))
Penalties
• curse: str
• point_deduction: int
Penalty = namedtuple(‘Penalty’, ‘curse point_deduction’)
one_day_penalty = Penalty(“Ear-Shrivelling”, 10)

# Define a Container of the total number of penalty points for every house
house_penalties = {“Gryffindor”: 0, “Hufflepuff”: 0, “Ravenclaw”: 0, “Slytherin”: 0}
Format Strings
Formatting strings for various reports. The width for most output is set to 60-characters
due_today_format_string = “{title:<35}{name:>25}”
due_report_format_string = “{title:<35}{name:>25}”
checkout_report_format_string = “{title:<30}{name:^20}{due_date:>10}”
user_report_format_string = “{title:<35}{due_date:>25}”
hold_report_format_string = “{name:<33}{number_of_days:^27}"