Professional Documents
Culture Documents
I confirm that I understand my coursework needs to be submitted online via Google Classroom under
the relevant module page before the deadline in order for my assignment to be accepted and marked.
I am fully aware that late submissions will be treated as non-submission and a marks of zero will be
awarded.
CC4002NA Information Systems
Proposal
This proposal is written to discourse the project that has been made under the
circumstances of assessment addressing the coursework of the module
Information Systems. This assessment covers an application comprising a library
management system which has the functionality of storing books, allows user to
borrow or return those books and also stores each and every information including
all of the transactions made by the user.
❖ Purpose:
The project includes algorithm, flowchart and pseudocode of the very
program to get start coding a working python program. Along with the program
statements the assignment also includes deep research with testing and
debugging processes.
❖ Problem statement:
In the context of our college, data entry, bill management, user
information, everything is stored in hard copy format which is not much reliable
procedure.
❖ Proposed approach:
. For covering all the errands of the assessment, following approaches
will be taken on:
➢ For the programming and documentation part get going on smoothly,
heavy research on the related topics will be done which includes
thorough study from books, websites and many helpful online journals.
➢ To get started on the workings of the program, an algorithm will be
written with descriptive steps to show the stepwise flow of data inside
the program.
➢ After the stepwise algorithm, pseudocode will be written which can make
resemblance to the original python code.
➢ Flowchart will also be made in order to show the flow of program
graphically.
➢ Then the program will be written in python which covers all functions a
library app should consist.
➢ And lastly there will be unsupervised testing of the working of the
program to ensure if it is bug and error free and ready to roll in the
market.
❖ Target audience:
Since this is a project derived for assignment purpose, I find using it for
college’s use more appropriate. So, I would like our college administration to
look over to my project and if they find this appropriate then using it for
educational purpose would be highly appreciated. Since handwriting method
for data entry is not reliable, my project could be a ray of hope for the
modernization of entry system in any institutions. Some of the features like
auto-creating bills, storing user data in separate files, etc could be much helpful
for the library to make transactions and keep up-to-date with the user data
Table of Contents
Introduction ................................................................................................................ 1
Discussion and analysis ............................................................................................. 1
Algorithm .................................................................................................................... 2
Pseudocode: .............................................................................................................. 4
Flowchart .................................................................................................................. 10
Data Structures in Python ........................................................................................ 13
1. Primitive Data Types ................................................................................... 13
a) Integers: ................................................................................................... 13
b) Float: ........................................................................................................ 13
c) Boolean:................................................................................................... 14
d) String: ...................................................................................................... 14
2. Collection Data Types ................................................................................. 14
a) List: .......................................................................................................... 14
b) Tuples: ..................................................................................................... 15
c) Set: .......................................................................................................... 15
d) Dictionaries: ............................................................................................. 15
Testing ..................................................................................................................... 25
Working of the program ............................................................................................ 20
CC4002NA Information Systems
Table of Figures
Figure 1: Gantt Chart.................................................................................................. 5
Figure 2: Flowchart Symbols (ConceptDraw, n.d.) ................................................... 10
Figure 3: Flowchart................................................................................................... 12
Figure 4: Datetime Module ....................................................................................... 18
Figure 5: JSON Data Format ................................................................................... 19
Figure 6: Writing data to JSON ................................................................................ 19
Figure 7: Reading data from JSON .......................................................................... 19
Figure 8: Sending Mail from Python ......................................................................... 21
Figure 9: Matplotlib in Python ................................................................................... 23
Figure 10: Black Box Testing (Stockdale, 2017) ...................................................... 25
Figure 11: Test-1 ...................................................................................................... 26
Figure 12: Test-2 ...................................................................................................... 27
Figure 13: Test-3 ...................................................................................................... 28
Figure 14: Test-4 ...................................................................................................... 29
Figure 15: Test-5 ...................................................................................................... 30
Figure 16: Test-6 ...................................................................................................... 31
Figure 17: Test-7 ...................................................................................................... 32
Table of Tables
Table 1: Test-1 ......................................................................................................... 26
Table 2: Test-2 ......................................................................................................... 27
Table 3: Test-3 ......................................................................................................... 28
Table 4: Test-4 ......................................................................................................... 29
Table 5: Test-5 ......................................................................................................... 30
Table 6: Test-6 ......................................................................................................... 31
CC4002NA Information Systems
Introduction
This report made for the assignment, consists of the library management system to be
written in python which has all the functionality a library should possess. The project
also included proper documentation of the program along with algorithm, pseudocode
and flowchart of the program.
The program has the functionality of storing books, allows user to borrow or return
those books and also stores each and every information including all of the
transactions made by the user. It also consists of rules the book should be returned
within 10 days of borrowing and If in case the prior rule is not followed then the user
will be fined on the daily basis. It stores all of the information in different text files
arranged according to their categories like, bills, available books and books remained
to return.
Algorithm
Algorithms are essential to the way computers process data. Many computer
programs contain algorithms that detail the specific instructions a computer should
perform (in a specific order) to carry out a specified task, such as calculating
employees' pay checks or printing students' report cards or borrowing and returning
any books from a library. (Wikipedia, n.d.)
Step-1: Start
Step-2: Input what do you want to do?
1) Borrow
2) Return
3) Exit
If 1: Go to step-3
If 2: Go to step-11
If 3: Go to step-14
Step-3: Read data from available books and display books with their price and
quantity
Step-4: Input user name, book name and quantity.
Step-5: Is book name in available books?
Yes: Go to step-6
No: Output, Book is not available in the library
Go to step-2
Step-6: Decrease quantity of book by the quantity in which it was borrowed
Step-7: Write all the data including book and user and store in a separate file
Pseudocode:
Method borrow_book:
OUTPUT books with price and quantity from available_books
INPUT user_name, book_name and quantity of book to borow
IF book_name in available books then
Total_price = Book’s Price * User quantity
OUTPUT book_name borrowed to user_name
SUBTRACT book quantity by quantity user borrowed
UPDATE data in available_books file
WRITE borrowing information in to_be_returned file
CALL method borrow_another from module 4
ELSE
Output book not available in the library yet.
END IF
Call method borrow_another from module 4 and pass user name,
book, quantity and total price as parameter
END Method
END Class
module 2: return_book:
Class Return:
READ “available_books.json” as available books and
“to_be_returned.json” as returning books
Method return_book:
IF returning_books.isempty() then
OUTPUT No books remained to return.
GOTO Main Method
END IF
INPUT username, bookname and quantity of book to return
FOR I, J in returning_books:
IF username == I and book name == j[bookname] :
IF current date < returning date then
OUTPUT :quantity: :bookname: returned
ADD the quantity in available_books
SUBTRACT the quantity from returning_books
UPDATE “available_books” and “to_be_returned”
ELSE:
CALL method generate_fine and output fine.
CALL method main from module 4
END IF
END IF
END FOR
END Method
END Class
module 3: generate_bill:
Class generate_bill
Method generate_bill:
:parameters: buyer_name, total_books, total_quantity, total_price
GET values from parameter
GENERATE random number
CREATE “randomnumber.txt” and :
write(Bill number)
write(buyer_name, total_books, total_quantity,
total_price,returning date)
END Method
END Class
module 4: main:
from module 1 import Borrow class
method intro:
Output the introduction message to the user including the rules
Ask approval from user
If approval == No then
exit from library
end if
method borrow_another:
Input choice: Do you want to choose another book?
If choice == yes then
Update the current_date
Call method borrow_book from module 1
else
If book bought then:
Output: book_names, total_price, current and
returning date, voucher from generate_voucher
Call method generate_bill from module 3 passing
current_date as argument
end if
Call main method
end if
method main:
Input user_action:
Flowchart
A flowchart is a graphical representation for the step-wise working of any
program or software. It is a tool for analyzing processes, programs or systems. It has
become an imperative part of developing an information system. Through the
graphical representation, a flowchart shows interconnection between the processes
that have been occurring during any program execution. A flowchart depicts the flow
of operation through a program or process by dividing the system or process into
events/activities and presenting the logical relationship between them.
Flowcharts are made up of a set of basic symbols; decision process, connector and
comment symbols. They are linked then using flow lines, to indicate the flow of control
through the program, process or system. (sad111414822, 2013)
Start
What to do ?
1)Borrow
C
2) Return
3)Exit app
(3)
(1)
Book.quantity -= quantity
Output, Book is
Is book_name in
not available in No Yes Write user and book info
the library available_books? along with date in separate
file
End
Output, Given
Check for the user name and
No information
book in the database file
didn t match
Yes
A
Is due crossed?
Yes
No
Generate fine and output to
user
Fine paid
Book.quantity += quantity
Figure 3: Flowchart
Data structures are a way of organizing and storing data so that they can be
accessed and worked with efficiently. They define the relationship between the data,
and the operations that can be performed on the data. There are many various kinds
of data structures defined that make it easier for the data scientists and the computer
engineers, alike to concentrate on the main picture of solving larger problems rather
than getting lost in the details of data description and access. (Jaiswal, 2017)
Integers:
They support only integer whole number values like 1,2, -1, 3, etc.
In this project integers are used for many purposes. Some of them are:
to get user choice (1, 2 or 3), for book quantity to perform mathematical
operation.
Integers are used in many places while developing this process. Since
integers are major object used in storing numeric values, it is used to
store many information for this project like, price of book, book quantity,
integer operation is used for calculating total prices of the books that
have been borrowed, and many more.
Float:
They contain all values of integer as well as numbers with floating
points consisting of decimal values. E.g. 1, 0.5, -8, etc. Float in this
project is used to store the value of prices of books as book’s price could
be of decimal points.
Floats are the numeric data type with decimal points. Since price of some
books may have decimal value, they cannot be stored as integer as
integer support only whole numbers. So, in this case floats are very
important and play great role.
Boolean:
They have either True or False values which can also be referred
to 1 and 0 respectively.
Booleans are great in case of loop.
String:
They are the sequence or list of characters, words or sentences. It
can be defined by using double (“) or single (‘) quotes. E.g. “Amit Kharel”.
They are used in this project to store book name, writer, user name, etc.
a) List:
It takes an array of integer, string or Boolean data type in any order
in any number. It is useful in storing data and is mutable. It declared by
square brackets []. We can also add two lists.
E.g. L = [1,2.5,’Hello’, False]
Since every variable are objects in python, there are many methods of
list class which provide varieties of functionalities like appending data
into a list, removing items, accessing items and many more.
List also has played vital role in storing data in this project. Book
information containing book name, writer, price and quantities of all
books are stored in separate lists for easy access and modification.
b) Tuples:
It works same as list but is immutable i.e. its value is fixed and
cannot be changed during program execution. It is declared by
parenthesis (). E.g. t = (1,2,3,4)
c) Set:
It is a type of collection data type which contains unique elements.
Its value can be changed according to the need. It is declared by curly
brackets {}. It is useful in performing various mathematical set
operations, union, intersection, etc. E.g. S = {1,2,3,4,5}
d) Dictionaries:
A dictionary is an unordered collection of key-value pairs with
unique keys. They are mutable, so items can be easily added/removed.
They are denoted using curly brackets {}. E.g. d = {‘name’: “Amit”,
‘age’:17}
Dictionaries are the backbone of this project. All of the information
from book lists to user information are all stored in a dictionary. By
making a unique key for every data entry, accessing and modify
becomes more efficient and accurate. In this project book name is used
as key and its value is stored in a list which contains all other information
of the book. Also, for returning files, we used date as key and user as
well as book info as value of the key. So, overall dictionary makes storing
data easier.
Research
For the completion of all the given tasks in out assignment, content taught in classes
were not sufficient. It needed much more understanding in working methods of python
and also some extra libraries to use in order to make a complete project. So, before
starting my project, I decided to make deep research on some of the topics related to
python like working with json files to store data, datetime module to get current date
and time, and other too. For my research, I took help from different websites, book
and journals some of which I have listed below.
1. Websites
Tkinter is the standard GUI library for Python. Python when combined with Tkinter
provides a fast and easy way to create GUI applications. Tkinter provides a
powerful object-oriented interface to the Tk GUI toolkit. We can also add texts,
buttons, check buttons, widgets, dropdown lists, menus and many more into our
GUI and make a fully functioning application using this library.
Using this, the project Library Management System just built can be made using
Tkinter and it becomes handier when using with GUI. So, it can be used to make
a GUI based library app.
From the documentation of official python site, I picked up datetime module which
would be very helpful for this project. Using this python library, we can get current date
and time as well as do operations like add 10 days, convert date-time into string, etc.
Since, we need to store the date and time of the borrowing of book and also the date
in which book has to be returned.
Since, python’s default file.write() method doesn’t allow us to write dictionary files
directly, I found a library called json which is considered to be best which working
with python dictionaries.
Below are the methods from very page describing process to read and write data in
json files.
This is one of the best websites for learning python for beginners as well as in
advanced level. It teaches from basics to high level of python even artificial
intelligence projects.
I learned different methods of creating class and using them. Many special
methods which can be used in class and used to change the property of class.
Also, I came to know about new library called “http request” which is used to make
web requests using python and can extract data from web directly into the python
program.
2. Books
• Learning with Python - Chris Meyers
Learning with Python is the book for python beginners which teaches us basics
of python. When I was reading this book, I find a special library. Along with other
special libraries available in python, there is also one which allows us to directly
send emails through mail servers. I uses “smtplib” and “email” module to send
email through mail servers.
I learned many network operations that can be made through python only
without moving to the browsers. Like sending mails, browsing sites, using
selenium library to control websites automatically, and many more.
When I was hopping up in the library, I found a book on python for data analysis
and when I read the contents, I found it very useful and full of new information
and functions in python although it was for master’s students.
Reading this, I came to find about a new python library called “matplotlib” which
is very useful in making mathematical graph plots and also for data analysis
process. It has easier syntax yet much powerful.
This module allows user to borrow book from the library. Firstly, it lists all the available
books from the library and asks the user to make their choice along with their name.
If the book is available in the library, it generates bill including all the respective
information in a file and also displays to the user. And it asks user to borrow another
book whose method is defined in module 4.
This module allows to return book to the library. It firstly reads the file containing
information of the borrowed books and asks user for which book to return with their
name. If the given information match, it then checks for the date for due and if due
crosses then it generates fine otherwise it simply returns book to the library.
This method generates bill of the book borrowed on the basis of the information passed
to this method from other modules like: User name, book, bought date, returning date
along with the bill number.
This is the main method which controls overall functioning of this project. It imports
methods and functions from other all modules, asks user to make a choice and makes
respective moves. It consists of method borrow another which allows user to borrow
another book at the same time and if user rejects it then it generates bill on the basis
of books borrowed previously.
Testing
Program testing is the process of executing a program with the intent of finding
errors. Testing brings efficiency in the program. More the tests, more is the accuracy
in program. The number of tests of any single program can be infinite. Testing makes
program error free. Currently there are many types of testing methods, the one which
is going to be demonstrated below is called “Black Box Testing”.
Test-1:
To give string input where int value is expected while program asks
Objective
us what to do.
Action 1. The main.py file is run.
2. E is given as input.
Expected The error message is displayed.
Result
Actual Result The error message is displayed saying “Enter a valid choice” and
the menu is displayed again.
Conclusion Test successful.
Table 1: Test-1
In the above test, the program asks to choose between 1,2 and 3 to borrow, return or
exit respectively. But in the input String value is given which is not valid for the input.
So, it displays error message saying “Enter a valid choice” and asks user to choose
again.
Test-2:
To provide the name of book which is not listed in the available
Objective
books of the library.
Action 1. The main.py file is run which calls borrow_book method,
displays list of books and asks user to choose one.
2. “Dream Coder” is given as input which is not displayed in
screen.
Actual Result The error message is displayed saying “Book not yet available
in the library” and it asks the user to choose another book.
Conclusion Test successful.
Table 2: Test-2
In this test, borrow book option is chosen which displays list of all the books available
in the library and asks user to choose one. So, for testing, book which is not listed
there i.e. book not available in the library is given as input to the book name. And, as
expected it displays an error message saying “Book not yet available in the library”
and asks user if they want to choose another book.
Test-3:
Objective To provide the serial number of book instead of book name.
Action 1. The main.py file is run which calls borrow_book method,
displays list of books and asks user to choose one.
2. 2 is given as input which goes for “Start With Why” in list.
Expected Result Information of book number 2 i.e. “Start With Why” is displayed.
Actual Result The program shows book name as “Start With Why” along with
price author and quantity as expected.
Conclusion Test successful.
Table 3: Test-3
For the third test, instead of giving the name of book in the input asking book name,
the serial number of the book is given. E.g. In this case for the book “Start With Why”,
2 is given as input. Now, usually the program produces error while giving integer input
when string is expected but this program is designed not to produce any errors in the
middle of program execution so that user interaction and curiosity of using the program
will not decline. So, in place of displaying error, it compiles the input and gives the
information of the book based on the index number assigned to the book as expected
by the user.
Test-4:
Objective To try borrowing the book more than the quantity available.
Action 1. The main.py file is run which calls borrow_book module.
2. “Harry Potter” is chosen as its quantity is 23.
Expected Result Error message is displayed.
Actual Result As expected, the program displays error message saying “Sorry,
the quantity you need is not available in our library.” And displays
the borrow another option menu.
Conclusion Test successful.
Table 4: Test-4
For testing this, the name of book whose quantity is 0 is provided as an input. And, as
expected the program throws error message saying “Sorry, the quantity you need is
not available in our library”.
Test-5:
To give wrong user name while returning the book who hasn’t
Objective
borrowed any book from the library.
Action 1. The main.py file is run which calls return_book module.
2. “Ajaspi” is given as input. (She hasn’t borrowed any book)
Expected Result Error message is displayed.
Actual Result As expected, the program displays error message saying “No
any books borrowed in the name of Ajaspi yet” and again
displays the main option menu.
Conclusion Test successful.
Table 5: Test-5
In this test, while returning the book to the library, name of the user who hasn’t
borrowed any books yet has been given. Here, the program checks the database of
the borrowed book history and returns result based on it. So, as expected it returned
“No any books borrowed” as no name in the database matched with the given user
input.
Test-6:
To give wrong book name while returning the book which doesn’t
Objective
match to the one which was borrowed by the user.
Action 1. The main.py file is run which calls return_book method.
2. “Dream Coder” is given as input.
Expected Result Error message is displayed.
Actual Result As expected, the program displays error message saying “Book
didn’t match. Try again.” and again displays the main option
menu.
Conclusion Test successful.
Table 6: Test-6
To test this, user name is given correct but book name which wasn’t bought by the
user is given. And, as expected the program gives error message saying “Book didn’t
match. Try again.” and returns to the action menu.
Test-7:
Actual Result The error message is displayed saying “Returning quantity more
than the borrowed one” and it goes to the main menu.
Conclusion Test successful.
Table 7: Test-7
For the last test, while returning book, the book quantity is given more than the actual
number of books that has been borrowed by the user. And, as expected error message
is displayed saying “Returning quantity more than the borrowed one” and again the
program goes to the main option menu.