Sie sind auf Seite 1von 24

T TE ER RM M P PA AP PE ER R

F FU UN ND DA AM ME EN NT TA AL L O OF F C CO OM MP PU UT TI IN NG G
N NA AM ME E - -- - C CH HI IR RA AN NJ JE EE EV V S SI IN NG GH HA AL L
R RO OL LL L N NO O. .. .R R2 20 03 3A A2 23 3
R RE EG G I ID D. .. . 1 10 08 80 01 14 42 28 8
S SE EC CT TI IO ON N - -- -- - 2 20 03 3
C CO OU UR RS SE E C CO OD DE E- -- -- - B B. .T TE EC CH H { {E EC CE E} }
D DE EP PT TT T. . L LO OV VE EL LY Y S SC CH HO OO OL L O OF F E EN NG GI IN NE EE ER RI IN NG G A AN ND D
S SC CI IE EN NC CE ES S

L LI IB BR RA AR RY Y M MA AN NA AG GM ME EN NT T S SY YS ST TE EM M

A AC CK KN NO OW WL LE ED DG GE EM ME EN NT T
I I A AM M V VE ER RY Y T TH HA AN NK KF FU UL L T TO O M MY Y S SU UB BJ JE EC CT T
T TE EA AC CH HE ER R M MR R. . R RA AJ JI IN ND DE ER R S SI IN NG GH H F FO OR R
A AS SS SI IN NN NI IN NG G M ME E T TH HI IS S P PR RO OJ JE EC CT T W WH HI IC CH H I IS S
L LI IB BR RA AR RY Y M MA AN NA AG GE EM ME EN NT T S SY YS ST TE EM M . .I I G GO OT T F FU UL LL L
S SU UP PP PO OR RT T O OF F M MY Y T TE EA AC CH HE ER R A AN ND D C C. .S S. .E E D DE EP PT TT T. .. .
F FO OR R C CO OM MP PL LE ET TI IO ON N O OF F M MY Y P PR RO OJ JE EC CT T S SO O I I
W WO OU UL LD D L LI IK KE E T TO O T TH HA AN NK K T TO O A AL LL L M MY Y T TE EA AC CH HE ER RS S
A AN ND D M MY Y F FR RI IE EN ND DS S , ,W WI IT TH HO OU UT T W WH HO OM M I I W WO OU UL LD D H HA AV VE E
B BE EE EN N N NO OT T A AB BL LE E T TO O C CO OM MP PL LE ET TE E T TH HI IS S P PR RO OJ JE EC CT T. .

Let us define the requirements for our Library
Management System (LMS):


Requirements

This software will allow members to register
Only registered members will be allowed to lend an item from the system
User can add items (Books, CD etc) to the system
System will allow searching for items in the system based on Author
name, book name, user name etc

Non requirements
System will not enforce any security. Anybody who has access to the
computer will be able to access this software and perform any operations.
There will be no login/password required to access this software.
System will not generate any alerts if a member is not returning any items
System will not maintain any inventory.
System doesn't keep track of damaged items. Users have to manually
replace the damaged items
with new ones.
System will not handle data security and backup. Users have depend on
some external or manual backup mechanism to take data backup
whenever required.

Design phase

After completing the requirement study and documentation, it is time to
design the software based on the provided requirements. It is easy to start
coding without any design and you may end up developing a product
which your customers like. But it may not be easy to maintain. Customers
may keep changing their mind. Only after seeing the product, they may
say 'we want this to behave in a different way'. And it is very hard to say
'NO' to a customer.

First step is identifying all the features you are going to implement in the
software. The requirements document is a good guide in identifying the
features. According to the requirements specification, we need to develop
the following features in the system:
Registration
Item Management
Lending
Search for Books
Search for Members

Registration

This feature allows to add/edit/delete members in the system. We should
be able to store at least the basic information like Name, Address, and
Email etc of the member. You can add more attributes like phone number,
homepage, date of registration etc.

Database structure:

Table Name : Users

Table Schema

Id : Number

Name : String (50)

Address : String (100)

Email : String (50)

Date of Registration : Date Time

We have defined 4 fields in the table above. You can add more fields.

When one design a windows form, one have to create text box controls to
capture the above fields.
One doesnt need to create textboxes to capture some fields like Id, Date
of Registration etc. Id can be an auto generated number. These numbers
will be automatically generated when you insert a record. You don't need
insert these numbers to the database). Also, the Date of Registration can
be the current date which you can be programmatically added to the
database instead of getting this from the user.

So, in this case, one need to capture only name, Address and Email from
the user.


When you save it, you have to save the name, address, email and current
date into the system.
The Id field will be automatically added to the table if you have set it as
'AutoNumber' or
'Identity' column.

If you add more fields to the table (like phone number etc) you must
provide appropriate controls to capture that information.


Item Management

Before we let a user to lend a book from the library, we need to keep the
list of items available in the
library. We will develop a feature to add/edit/delete items in the library.

An item (Book, CD etc) in the library can have the following properties:

Name
Author
Total number of books (we may have more than one copy of the same
book)

Let us define database schema for this:

Id : Number (Auto number)

Name : String

Count : Number




One may add more fields like Publisher Name, Book Category etc.



Lending
This feature includes the following:
Allow a member to take a book from library
Return a book to the library

We need the following fields:
Id : Auto number
Book Id : Number - This is the ID of the book
User Id : Number - Id of the member who lend the book
Date Of Lend : Date Time
Date of Return: Date Time - this field will filled only at the time of return

This is an important feature and bit more complex than other features.
When a user takes the book, we will store the Id of the book and Id of the
member in the above table. Note that we are not storing the name of the
book and name of user. We are just storing the Ids.

It is important to save the exact Book Id and member Id when lending a
book. It is a good idea to make those two fields read only so that user don't
need to type them (they might make mistakes if they type the id number).
One can also provide a feature to search for the books and member. User
can search and find the book and member. Once they find in the search
screen, user can just select it from the list. When they select a book or
member from the search results, you can programmatically populate the
Book Id and Member Id fields.



The search buttons for Book Id and member Id should open another
window where user can search for Books and Members and select one.
When selected in the search window, the selected Id should be populated
in this form.

Search for Books

User should be able to search for books by Book Name, author name etc.
The results can be displayed using a data grid. User must be able to select
a record from the search results.



This form will be called from other screens like Lending screen etc. User
can search by Book name of author name. The search results will be
displayed in the data grid below. From the data grid, user can select a
record and press the 'select' button. When a record is 'selected', this form
should be closed and the selected Books Id should be populated in the
appropriate field in the calling form (like lending form).

Source Code


#include<stdio.h>
#include<dos.h>
#include<ctype.h>
#include<stdlib.h>
#include<string.h>
#define nm 20
#define cal 2
#define idn 5
#define dt 2
void chk_name(char *p,int);
void chk_id(char *p,int);
int duplicate(char temp[]);
int duplicatest(char temp[]);
void studinfo();
void issue();
void returned();
void viewstfo();
void view1();
void stuissue();
struct lib { char bname[nm];
char bid[idn];
} lib1;
struct isue { char sid[idn];
char bid[idn];
int isdate;
int redate;
} iss1;
struct ret { char sid[idn];
char bid[idn];
int redate;
} ret1;
struct st { char sid[idn];
char sname[nm];
//struct lib lib2;
//struct isue iss2;
//struct ret ret2;
} st1;
void main()


{ int choice;


gotoxy(1,1);


do{
printf("\nThis is library module\n1.Issue book\n2.Return
book\n3.View issued books\n4.Student info\n5.View student
info\n6.Exit\n7.Issued by one student ");
scanf("%d",&choice);
switch(choice)
{ case 1: issue(); break;
case 2: returned(); break;
case 3: view1(); break;
case 4: studinfo(); break;
case 5: viewstfo(); break;
case 6: exit(0);
case 7: stuissue(); break;
default: printf("One among 1,2,3,4");
getch();
}
}while(choice!='6');
}
//Function definitions
void issue()


{ char temp[idn];
char btemp[idn];
FILE *fp;
fp=fopen("boissue.rec","ab");
printf("\nEnter book id:");
chk_id(btemp,idn);
strcpy(iss1.bid,btemp);


{ struct date d;
getdate(&d);
printf("\nTodays date:%d",d.da_day);
iss1.isdate=d.da_day;
}
iss1.redate=iss1.isdate+10;
printf("\nEnter student's ID:");
chk_id(temp,idn);
strcpy(iss1.sid,temp);
fwrite(&iss1,sizeof(iss1),1,fp);
printf("\nINfo saved , can be issued");
printf("\nExpected date of return is comming: %d",iss1.redate);
}
void returned()


{ char temp[idn];
int ch;
FILE *fp;
fp=fopen("boissue.rec","rb");
printf("Enter book's code:");
chk_id(temp,idn);
while(fread(&iss1,sizeof(iss1),1,fp)&&strcmp(temp,iss1.bid));
ch=strcmp(temp,iss1.bid);
if(ch!=0)
{ printf("No such book");}
else
{ fseek(fp,ftell(fp)-sizeof(iss1),0);
fwrite(&iss1,sizeof(iss1),1,fp);
printf("Book returned");
}
fclose(fp);
}
void chk_name(char *p,int size)


{ char ch,c[30];
int i=0;


do {
ch=getch();
if(((ch>='a' && ch<='z')||(ch==' ')||(ch>='A'&&
ch<='Z'))&&(i<size-1))
{ *p++=ch;
i++;
printf("%c",ch);
}
else
if(ch==8 &&i>0)
{ printf("%c%c%c",8,32,8);
i--;
p--;
}
}while(ch!=13);
c[i]='\0';
*p='\0';
}
void chk_id(char *p,int size)


{ char ch;
int i=0;


do {
ch=getch();
if((ch>='0' && ch<='9')&&(i<size-1))
{ *p=ch;
i++;
p++;
printf("%c",ch);
}
else
if(ch==8 &&i>0)
{ printf("%c%c%c",8,32,8);
i--;
p--;
}
}while(ch!=13 || i<size-1);
*p='\0';
}
int duplicate(char temp[])


{ FILE *fp;
fp=fopen("boissue.rec","rb");

while(fread(&iss1,sizeof(iss1),1,fp)&&strcmp(iss1.sid,temp));
fclose(fp);
if(strcmp(temp,iss1.sid)==0)
return 1;
else
return 0;
}
/*void view1()


{ int ch;
FILE *fp;
fp=fopen("boissue.rec","rb");
if(fp!=NULL)


{
while(fread(&iss1,sizeof(iss1),1,fp))
if(strcmp(iss1.sid," ")!=0)
{ printf("\nStudent ID:%s Book ID:%s Issue date:%d Due
return date:%d\n",iss1.sid,iss1.bid,iss1.isdate,iss1.redate);
}
if(strcmp(iss1.sid," ")==NULL)


{ printf("Not found"); }}
else


{ printf("Unable to open file"); }
}
*/
void studinfo()


{ char temp[idn];
FILE *fp;
if(fp!=NULL)


{
fp=fopen("studinfo.rec","ab");
do { printf("\nEnter unique student ID:");
chk_id(temp,idn);
} while(duplicatest(temp));
strcpy(st1.sid,temp);
printf("\nEnter student's name:");
chk_name(st1.sname,nm);
fwrite(&st1,sizeof(st1),1,fp);
fclose(fp);
}
else


{ printf("File not found"); }
}
int duplicatest(char temp[])


{ FILE *fp;
fp=fopen("studinfo.rec","rb");
while(fread(&st1,sizeof(st1),1,fp)&&strcmp(st1.sid,temp));
if(strcmp(st1.sid,temp)==0)
{ return 1; }
else
return 0;
}
void viewstfo()


{ int ch;
FILE *fp;
fp=fopen("studinfo.rec","rb");
if(fp!=NULL)


{
while(fread(&st1,sizeof(st1),1,fp))
if(strcmp(st1.sid," ")!=0)
{ printf("\nStudent id:%sStudent name:%s ",st1.sid,st1.sname); }
if(strcmp(st1.sid," ")==NULL)
{ printf("No records"); }
fclose(fp);
}
else


{ printf("File not found"); }
}
void view1()


{ int ch;
FILE *fp,*f;
fp=fopen("boissue.rec","rb");
f=fopen("studinfo.rec","rb");
if(fp!=NULL)


{
while(fread(&iss1,sizeof(iss1),1,fp)&&fread(&st1,sizeof(st1),1,f))
if((iss1.sid," ")!=0)
if(strcmp(iss1.sid,st1.sid)==0)


{
printf("\nStudent ID:%s Book ID:%s Issue date:%d Due
return date:%d Student
name:%s",iss1.sid,iss1.bid,iss1.isdate,iss1.redate,st1.sname);
}
if(strcmp(iss1.sid," ")==NULL)


{ printf("Not found"); }
}
else


{ printf("Unable to open file"); }
}
void stuissue()


{ char temp[idn];
FILE *fp;
fp=fopen("boissue.rec","rb");
printf("Please enter student id:");
chk_id(temp,idn);
while(fread(&iss1,sizeof(iss1),1,fp))
if(strcmp(iss1.sid," ")!=0)
if(strcmp(iss1.sid,temp)==0)


{ printf("\nStudent id:%sBook ID:%s",iss1.sid,iss1.bid);
}
fclose(fp);
}

Das könnte Ihnen auch gefallen