You are on page 1of 39

Information Systems

Module Code & Module Title


CC4002NA Information Systems

Assessment Weightage & Type


20% Individual Coursework

Year and Semester


2018-19 Autumn

Student Name: Amit Kharel


London Met ID:
College ID: NP01CP4A180219
Assignment Due Date: 2019/01/18
Assignment Submission Date: 2019/01/16

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.

❖ Aims and Objectives:


The main aim of this project is to meet the requirements consisting all
the facilities available in any of the libraries out there. Our target is to fulfil the
needs of any librarians and sufficient amount of data and information to be
provided through the app. Our main objectives are:
• To provide user friendly interface to interact with.
• Needed amount of data and information of data can be stored for future
use in any kind of emergency where papers and file can get lost or
damaged.
• All the features that a library app should have are to be included in this
project along with the modern techniques useful in present context.
CC4002NA Information Systems

❖ 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

❖ Hardware and Software requirements:


As this project compiles up of only a simple python library, any
personal computers of usual specifications can handle this program smoothly.
Just an installation of python is sufficient for this program to rock and roll in
your own computers.
CC4002NA Information Systems

❖ Timeline and Activity:


Since this project embraces of immense python program holding full
documentation of the assessment, preparation for the completion should have
to be done from the very first day of the arrival of coursework. Here are the
strategies that are planned to be carried out for the completion of the
assignment:
 First task to initiate the project is to understand the scenario of the
project, to understand the flow of the data inside the library management
system. So, I planned to study the scenario of the project surfacely for 2
days along with consulting with tutors and lecturers about the project.
 Then I will start making research on various aspects for not less than 4
days which could be much helpful for me while doing this project. Some
of them may include python data types, file handling, exception handling,
working with json files while storing and reading dictionaries in the json
files, python classes and methods and different data operations too.
 Then from the new year I will start creating algorithm and pseudocode
of the program as they are the backbone for the proper understanding
and developing any program. Along with this, flowchart will also be
prepared to represent the stepwise working of the program graphically.
 Finally, after completion of the documentation part of program, coding
part will get started followed by the short description of working of the
program.
 After the completion of coding, the modules and functions will be testing
using Black-Box testing technique to make sure our program is bug and
error free.

Also, to represent my assignment strategy a Gantt Chart is displayed in the


next page which illustrates my project schedule.
CC4002NA Information Systems

Figure 1: Gantt Chart


CC4002NA Information Systems

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.

Discussion and analysis

Amit Kharel January 10, 2019 1


CC4002NA Information Systems

Algorithm

An algorithm is a set of rules that precisely defines a sequence of operations which


would include all computer programs, including programs that do not perform numeric
calculations. Generally, a program is only an algorithm if it stops eventually.

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.)

Below is the algorithm representing the stepwise processing of library management


system:

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

Amit Kharel January 10, 2019 2


CC4002NA Information Systems

Step-8: Do you want to borrow another?


Yes: Go to step-3
No: Go to step-10
Step-10: Take the borrowing info, generate the bill and display to the user for
transaction and go to step-2
Step-11: Input user name, book and quantity to return
Step-12: Read the file containing. borrowed books
Step-13: Is user_name and book in file?
Yes: If returning due is crossed then
Generate fine and output to the user
Else:
Output, Book is successfully returned to the library
Increase the quantity of book by the quantity returned
Remove the borrowing information of book from the file
No: Output, given information doesn’t match
Go to step-2
Step-14: End

Amit Kharel January 10, 2019 3


CC4002NA Information Systems

Pseudocode:

Pseudocode is an informal high-level description of the operating principle of a


computer program or other algorithm. Since it uses high level language i.e. English
language, it can easily be understood and converted into any programming languages.

It uses the structural conventions of a normal programming language, but is intended


for human reading rather than machine reading. Pseudocode typically omits details
that are essential for machine understanding of the algorithm, such as variable
declarations, system-specific code and some subroutines. The programming
language is augmented with natural language description details, where convenient,
or with compact mathematical notation. The purpose of using pseudocode is that it is
easier for people to understand than conventional programming language code, and
that it is an efficient and environment-independent description of the key principles of
an algorithm. It is commonly used in textbooks and scientific publications that are
documenting various algorithms, and also in planning of computer program
development, for sketching out the structure of the program before the actual coding
takes place. (Wikipedia, n.d.)

Because pseudocode is detailed yet readable, it can be inspected by the team of


designers and programmers as a way to ensure that actual programming is likely to
match design specifications. Catching errors at the pseudocode stage is less costly
than catching them later in the development process. Once the pseudocode is
accepted, it is rewritten using the vocabulary and syntax of a programming language.
Pseudocode is sometimes used in conjunction with computer-aided software
engineering-based methodologies.(Rouse, 2005)

Amit Kharel January 10, 2019 4


CC4002NA Information Systems

The pseudocode representing the Library Management system is given below:

algorithm Library Management System


Class Borrow:
READ “available_books.json” as available books and
“to_be_returned.json” as returning books
GET current date and time and add 10 days to it and assign to the
returning date

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

Amit Kharel January 10, 2019 5


CC4002NA Information Systems

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

Amit Kharel January 10, 2019 6


CC4002NA Information Systems

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

Amit Kharel January 10, 2019 7


CC4002NA Information Systems

from module 2 import Return class


from module 3 import Bill class
class Library:
On Initialization of class (constructor or __init__) run,
Input: user_name, book_name
Open and read the files “available_books.json” as available
books and “to_be_returned.json” as returning books
Get current date and time assign to the current date

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:

Amit Kharel January 10, 2019 8


CC4002NA Information Systems

“What do you want to do?"


"1) Borrow"
"2) Return"
"3) Exit"
If user_action == 1 then
Make an instance of class BorrowBook as borrow
From borrow call method borrow_book
else if user_action ==2 then
Make an instance of Return class as return
Input: Name of user, Book to return
From return call method return_book passing input
values as argument
else if user_action == 3 then
Output Thank You message
Exit from the library
else
Call main method
End class
Call intro and main methods from Library class
End algorithm

Amit Kharel January 10, 2019 9


CC4002NA Information Systems

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)

Figure 2: Flowchart Symbols (ConceptDraw, n.d.)

Below is the flowchart for the Library Management System:

Amit Kharel January 10, 2019 10


CC4002NA Information Systems

Start

What to do ?
1)Borrow
C
2) Return
3)Exit app
(3)

(1)

Read data from available


books database

Display books with


their price and
quantity

Input user name


and book name

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

Do you want to borrow


Yes
another?

No Generate bill and display to


the user

End

Amit Kharel January 10, 2019 11


CC4002NA Information Systems

Input user name,


book and quantity
to return

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

Output Book is returned

Book.quantity += quantity

Update the database

Figure 3: Flowchart

Amit Kharel January 10, 2019 12


CC4002NA Information Systems

Data Structures in Python

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)

There are two types of data structures in python. They are:

1. Primitive Data Types


They are simple data types built in python. They can only store simple
values for operation. Some of the primitive data types available in python are:

 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.

Amit Kharel January 10, 2019 13


CC4002NA Information Systems

 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.

2. Collection Data Types


Non-primitive or Collection data types are the data structures which can
store bunch of values in a collection in ordered or unordered manner. They can
store any amount of data of different data types collectively and also provide
easy interface in accessing and modifying those data.
Some default collection data types built in python are:

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.

Amit Kharel January 10, 2019 14


CC4002NA Information Systems

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.

Amit Kharel January 10, 2019 15


CC4002NA Information Systems

Amit Kharel January 10, 2019 16


CC4002NA Information Systems

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

 Python - GUI Programming (Tkinter) - tutorialspoint

Figure 4: Creating GUI with Tkinter

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,

Amit Kharel January 10, 2019 17


CC4002NA Information Systems

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.

 Date-time module - Python Docs

Figure 5: Datetime Module

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.

Amit Kharel January 10, 2019 18


CC4002NA Information Systems

 Working with JSON - realpython

Figure 6: JSON data Format

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.

Figure 8: Reading data from JSON

Figure 7: Writing data to JSON

Amit Kharel January 10, 2019 19


CC4002NA Information Systems

 Object Oriented Python Programming - Harrison

Figure 9: Defining python class and methods

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.

Amit Kharel January 10, 2019 20


CC4002NA Information Systems

2. Books
• Learning with Python - Chris Meyers

Figure 10: Sending Mail from Python

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.

Amit Kharel January 10, 2019 21


CC4002NA Information Systems

Amit Kharel January 10, 2019 22


CC4002NA Information Systems

• Python for Data Analysis – Wes McKinney

Figure 11: Matplotlib in Python

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.

Amit Kharel January 10, 2019 23


CC4002NA Information Systems

Working of the program

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.

Amit Kharel January 10, 2019 24


CC4002NA Information Systems

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”.

BLACK BOX TESTING, also known as Behavioural Testing, is a software testing


method in which the internal structure/design/implementation of the item being tested
is not known to the tester. These tests can be functional or non-functional, though
usually functional. This method is named so because the software program, in the
eyes of the tester, is like a black box; inside which one cannot see.
(Software Testing Fundamentals, n.d.)

Figure 12: Black Box Testing (Stockdale, 2017)

Amit Kharel January 10, 2019 25


CC4002NA Information Systems

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

Figure 13: 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.

Amit Kharel January 10, 2019 26


CC4002NA Information Systems

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.

Expected Result The error message is displayed.

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

Figure 14: 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.

Amit Kharel January 10, 2019 27


CC4002NA Information Systems

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

Figure 15: 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.

Amit Kharel January 10, 2019 28


CC4002NA Information Systems

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

Figure 16: 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”.

Amit Kharel January 10, 2019 29


CC4002NA Information Systems

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

Figure 17: 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.

Amit Kharel January 10, 2019 30


CC4002NA Information Systems

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

Figure 18: 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.

Amit Kharel January 10, 2019 31


CC4002NA Information Systems

Test-7:

To return the quantity of book more than the number in which it


Objective
was borrowed.
Action 1. The main.py file is run which calls return_book method
and asks for user name, book and quantity.
2. 100 is given as input where only 10 books were borrowed.

Expected Result The error message is displayed.

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

Figure 19: 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.

Amit Kharel January 10, 2019 32

You might also like