Docstoc

Hostel

Document Sample
Hostel Powered By Docstoc
					                                 OF

               Hostel Management System




   Submitted in the partial fulfillment of the Degree of Bachelor of
                      Technology (Integrated)
                                   In
                 Computer Science and Engineering


SUBMITTED BY:-                               GUIDED BY:
Name Pankaj Negi                             Miss Sukhdilpreet Kaur
Regd.No 10804097
Rollno R246A10



                       SUBMITTED TO
Department of Computer Science and Engineering Lovely Professional
                      University Phagwara
                    ACKNOWLEDGEMENT

I take this opportunity to present my votes of thanks to all those guidepost
who really acted as lightening pillars to enlighten our way throughout this
project that has led to successful and satisfactory completion of this study.
We are really grateful to our HOD Mr. Rohit Dhand for providing us with
an opportunity to undertake this project in this university and providing us
with all the facilities. We are highly thankful to Miss Sukhdilpreet Kaur for
her active support, valuable time and advice, whole-hearted guidance,
sincere cooperation and pains-taking involvement during the study and in
completing the assignment of preparing the said project within the time
stipulated.
Lastly, We are thankful to all those, particularly the various friends , who
have been instrumental in creating proper, healthy and conductive
environment and including new and fresh innovative ideas for us during
the project, their help, it would have been extremely difficult for us to
prepare the project in a time bound framework.


                                          Name Pankaj Negi
                                          Reg.No 10804097
                                          Rollno. R246A10
TABLE OF CONTENTS


   Introduction

   Proposed system

     Description

     System requirements

   Requirement Analysis

   System Design

   Source code

   Testing

   Future scope of project
                       INTRODUCTION
In the existing system, most of the records are maintained on paper.
It becomes very inconvenient to modify the data. In the existing
system, here is a possibility that the same data in different registers
may have different values which means the entries of the same data
do not match. This inconsistent state does not supply the concrete
information which poses a problem in the case information related
to particular search record.
Our project is very useful. User is no longer required to check his
register in search of records, as now it can be searched over the
software by choosing some options. The user need not to type in
most of the information. He/she is just required to enter the desired
options. On the whole it liberates the user from keeping lengthy
manual records. In a nutshell, it abates the work load of an
organization.
In today’s world, no one likes to perform calculations on calculator
or manually when computer is there. Every one wants his/her work
to be done by computer automatically and displaying the result for
further manipulations.
PROPOSED SYSTEM
The following documentation is a project the “Hostel ManagementSystem ”.
It is a detailed summary of all the drawbacks of the old system and how the
new proposed system overcomes these shortcomings. The new system takes
into account the various factors while designing a new system. It keeps into
the account the Economical bandwidth available for the new system. The
foremost thing that is taken care of is the Need and Requirements of the User.

DESCRIPTION
Before developing software we keep following things in mind that we can
develop powerful and quality software
PROBLEM STATEMENT
   o   Problem statement was to design a module:
   o   Which is user friendly
   o   Which will restrict the user from accessing other user’s data.
   o   Which will help user in viewing his data and privileges.
   o   Which will help the administrator to handle all the changes.
FUNCTIONS TO BE PROVIDED:
The system will be user friendly and completely menu driven so that the users
shall have no problem in using all options.
   o The system will be efficient and fast in response.
   o The system will be customized according to needs.
   o Add
   o Display
   o Modify
   o Delete


SYSTEM REQUIRMENTS

Operating system:    MS Windows XP or Windows Vista
Language: C Language
Processor: Pentium IV Processor
RAM: 512 MB
Hard disk: 5 GB
                   REQUIREMENT ANALYSIS
This process is adopted when management of the system development,
Personnel decide that the particular system needs improvement. The system
development life cycle is the set of activities, carried out by the analyst,
designers and users to develop and implement a system. The systems that are
present in the nature follow common life cycle pattern. For example consider
the raining system. Initially the rain falls into the river, river flows into sea,
the sea water evaporates to form vapors, the vapors form clouds which again
bring rain. Similarly consider a man made system initially a system is
analyzed, designed and made operational by the efforts of system analysis.
After successful operation or a number of users, the system becomes less and
less effective by change in the environment. So these changes have to be
incorporated in to the system by minor modifications. So the general activities
from the life cycle of the system are given below:
    Select ion and identification of the system to be studied
    Preliminary study
    Defining the system
    Design and development of the system
    Implementation of the system
                           SYSTEM DESIGN
Then we began with the design phase of the system. System design is a solution, a
“HOW TO” approach to the creation of a new system. It translates system
requirements into ways by which they can be made operational. It is a translational
from a user oriented document to a document oriented programmers. For that, it
provides the understanding and procedural details necessary for the implementation.
Here we use Flowchart to supplement the working of the new system. The system
thus made should be reliable, durable and above all should have least possible
maintenance costs. It should overcome all the drawbacks of the Old existing system


                                  START



                        Hostel Management System



                                  Enter
                                  your
                                  choice
                                  eeeeee




    1. Out student    2. In student           3. Staff       4. Exit




                                 Enter Your
                                 choice




                                      STOP


and most important of all meet the user requirements.




Figure 1no
                            SOURCE CODE
/************************************************************************
***
* File        : HOSTEL.C
* Description : Hostel management system to maintain student details as well
                as staff details..
* Author       : Pankaj Negi,I Year B.Tech.,LOVELY PROFESSIONAL University.
* Version      : 1.0
* Date         : 14/DEC/2008
*************************************************************************
***/
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
/************************************************************************
****
* Function      : main
* Description :The main function is used for whole hostel management process.
* Parameters : void
* Returns       : Void
*************************************************************************
****/
void main()
{
int iCh1,iInc;
e:
clrscr();
/* To Display Main menu */
gotoxy(26,40);
textcolor(9);
cprintf("INFOSYS CAMPUS CONNECT PROGRAM");
gotoxy(32,44);
textcolor(19);
cprintf("LPU UNIVERSITY");
gotoxy(16,42);
cprintf("HOSTEL MANAGEMENT SYSTEM DONE BY PANKAJ NEGI");
gotoxy(8,45);
textcolor(9);
/* To Dispaly date and time */
cprintf("DATE : %s ",__DATE__);
gotoxy(55,45);
cprintf("TIME : %s ",__TIME__);
for(iInc=0;iInc<=30;iInc++)
{
gotoxy(20,iInc);
textcolor(7);
cprintf("-");
}
for(iInc=0;iInc<80;iInc++)
{
gotoxy(iInc,30);
textcolor(7);
cprintf("|");
}
gotoxy(30,8);
textcolor(9);
/* Main menu */
cprintf("HOSTEL MANAGEMENT SYSTEM");
gotoxy(30,10);
textcolor(19);
cprintf("1.OUT STUDENT");
gotoxy(30,12);
cprintf("2.IN STUDENT");
gotoxy(30,14);
cprintf("3.STAFF");
gotoxy(30,16);
cprintf("0.EXIT");
gotoxy(30,18);
textcolor(9);
cprintf("ENTER YOUR CHOICE:");
scanf("%d",&iCh1);
if(iCh1==0)
{
/* To exit from the system */
gotoxy(30,28);
textcolor(4);
cprintf("SYSTEM SHUTTING DOWN");
sleep(3);
gotoxy(26,40);
printf("INFOSYS CAMPUS CONNECT PROGRAM");
gotoxy(8,42);
printf("HOSTEL MANAGEMENT SYSTEM DONE BY PANKAJ NEGI");
gotoxy(8,45);
printf("DATE : %s ",__DATE__);
gotoxy(55,45);
printf("TIME : %s ",__TIME__);
exit(0);
}
else{
/* Declarations of Variables */
FILE *fp,*ft;
char cAns,cChoice;
struct hostel
{
char
acPhistory[50],acName[30],acDesiq[20],acStreet[30],acCity[24],acPhno[11],acDoj[11],
acRoom[4],acP_id[4],acSex[2];
int iAge,iSal;
};
struct hostel e;
char icPid[4];
int iF=0,iC=0,iF1=0;
long int lRecsize;
fp=fopen("hp.dat","rb+");
if(fp==NULL)
{
fp=fopen("\hp.dat","wb+");
if(fp==NULL)
{
puts("\n\t\tCannot Open file");
exit();
}
}
lRecsize=sizeof(e);

while(1)
{
clrscr();
textcolor(4);
if(iCh1==1) {
gotoxy(30,8);
textcolor(4);
/* Sub menu for manipulation of student and staff details */
cprintf("OUT-student MENU"); }
else if(iCh1==2) {
gotoxy(30,8);
textcolor(4);
cprintf("IN-student MENU"); }
else if(iCh1==3) {
gotoxy(30,8);
textcolor(4);
cprintf("STAFF MENU"); }
gotoxy(26,40);
textcolor(4);
cprintf("INFOSYS CAMPUS CONNECT PROGRAM");
gotoxy(32,44);
textcolor(19);
cprintf("LPU UNIVERSITY");
gotoxy(16,42);
textcolor(19);
cprintf("HOSTEL MANAGEMENT SYSTEM DONE BY PANKAJ NEGI");
gotoxy(8,45);
textcolor(4);
cprintf("DATE : %s ",__DATE__);
gotoxy(55,45);
cprintf("TIME : %s ",__TIME__);
for(iInc=0;iInc<=30;iInc++)
{
gotoxy(20,iInc);
textcolor(7);
cprintf("-");
}
for(iInc=0;iInc<=80;iInc++)
{
gotoxy(iInc,30);
textcolor(7);
cprintf("|");
}
gotoxy(30,10);
textcolor(19);
cprintf("1.ADD ");
gotoxy(30,12);
cprintf("2.DISPLAY");
gotoxy(30,14);
cprintf("3.MODIFY");
gotoxy(30,16);
cprintf("4.DELETE");
gotoxy(30,18);
cprintf("0.EXIT");
gotoxy(30,20);
textcolor(4);
cprintf("SELECT YOUR OPTION: ");
fflush(stdin);
cChoice=getche();
clrscr();
gotoxy(25,8);
textcolor(5);
switch(cChoice)
{
case '1':
  //To add a record
  w:
  printf("\n\n\n\t\tENTER ID: ");
  scanf("%s",icPid);
  rewind(fp);
  //Checking for unique id
  while(fread(&e,lRecsize,1,fp)==1)
  {
  if(strcmp(e.acP_id,icPid)==0)
  {
  iF=1;
  printf("\n\t\tALREADY EXISTS");
  goto w;
  }}
  if(iF==0||fread(&e,lRecsize,1,fp)==0)
  {
  fseek (fp,0,SEEK_END);
  strcpy(e.acP_id,icPid);
  a3:
  printf("\n\t\tENTER NAME: ");
  scanf("%s",e.acName);
  if(strlen(e.acName)>30||strlen(e.acName)<3)
goto a3;
if(iCh1==3){
a4:
printf("\n\t\tENTER DESIGNATION: ");
scanf("%s",e.acDesiq);
if(strlen(e.acDesiq)>20||strlen(e.acDesiq)<3)
goto a4;
  }
if(iCh1!=3){
printf("\n \t\tENTER CONSULTANT NAME: ");
scanf("%s",e.acDesiq); }
p:
printf("\n \t\tENTER SEX [M/F]: ");
scanf("%s",e.acSex);
if(strlen(e.acSex)>1)
goto p;
f:
printf("\n \t\tENTER AGE : ");
scanf("%d",&e.iAge);
if(iCh1==3){
if(e.iAge<20||e.iAge>65)
goto f; }
else
{ if(e.iAge<0||e.iAge>100)
goto f; }
a5:
printf("\n \t\tENTER STREET: ");
scanf("%s",e.acStreet);
if(strlen(e.acStreet)>30||strlen(e.acStreet)<5)
goto a5;
a6:
printf("\n \t\tENTER CITY: ");
scanf("%s",e.acCity);
if(strlen(e.acCity)>24||strlen(e.acCity)<3)
goto a6;
a:
printf("\n \t\tENTER CONTACT NUMBER: ");
scanf("%s",e.acPhno);
if(strlen(e.acPhno)>10||strlen(e.acPhno)<10)
goto a;
if(iCh1!=3){
a2:
printf("\n \t\tENTER STUDENT HISTORY: ");
scanf("%s",e.acPhistory);
if(strlen(e.acPhistory)>50)
goto a2;
}
if(iCh1==3) {
printf("\n \t\tENTER DATE OF JOIN(dd-mmm-yy): ");
scanf("%s",e.acDoj);
v:
  printf("\n\t\tSALARY/DAY: ");
  scanf("%d",&e.iSal);
  if(e.iSal<100 || e.iSal>9000)
  goto v;
  }
  if(iCh1==2)
  {
   printf("\n\t\tENTER ROOM NUMBER: ");
   scanf("%s",e.acRoom);
   printf("\n \t\tENTER DATE OF JOIN: ");
   scanf("%s",e.acDoj);
   }
  fwrite(&e,lRecsize,1,fp);
  /*Flushes a stream On success returns 0 , On error returns EOF */
  fflush(stdin);
  }
  break;
case '2':
  //Searching and displaying all the information by id
  textcolor(7);
  printf("\n\n\n\t\tENTER ID: ");
  scanf("%s",icPid);
  rewind(fp);
  while(fread(&e,lRecsize,1,fp)!=0)
  {
  printf("hai");
  if(strcmp(e.acP_id,icPid)==0)
  { printf("bye");
 iC=1;
 clrscr();
 //Display according to Main menu
 gotoxy(0,20);
 //outpatient
 if(iCh1==1){
 printf("\n\n\n\t\tDETAILS OF OUTstudent:%s",strupr(e.acName));

printf("\n_________________________________________________________________
____\n\n");
 printf("\n\n NAME : %s\t ID : %s\t CONSULTANT NAME : %s\n\n SEX :
%s\t AGE : %d \n\n STREET: %s\n\n CITY : %s\n\n PHONE : %s\n\n PATIENT
HISTORY:
%s",strupr(e.acName),strupr(e.acP_id),strupr(e.acDesiq),strupr(e.acSex),e.iAge,stru
pr(e.acStreet),strupr(e.acCity),strupr(e.acPhno),strupr(e.acPhistory));

printf("\n_________________________________________________________________
____\n\n");
  getch(); }
  //Staff
 else if(iCh1==3){
  printf("\n\n\n\t\tDETAILS OF :%s %s",strupr(e.acDesiq),strupr(e.acName));
printf("\n_________________________________________________________________
____\n\n");
 printf("\n\n NAME : %s\t ID : %s \t DESIGNATION: %s\n\n SALARY : Rs
%d(/day)\n\n AGE : %d \t SEX : %s \n\n DATE OF JOIN : %s\n\n STREET:
%s\n\n CITY : %s\n\n PHONE : %s
",strupr(e.acName),strupr(e.acP_id),strupr(e.acDesiq),e.iSal,e.iAge,strupr(e.acSex),st
rupr(e.acDoj),strupr(e.acStreet),strupr(e.acCity),strupr(e.acPhno),strupr(e.acPhistor
y));

printf("\n_________________________________________________________________
____\n\n");
 getch(); }
 //Inpatient
 else if(iCh1==2){
 printf("\n\n\n\t\tDETAILS OF INstudent:%s",strupr(e.acName));

printf("\n_________________________________________________________________
____\n\n");
  printf("\n\n NAME : %s\t ID : %s\t CONSULTANT NAME : %s\n\n AGE :
%d\t SEX : %s \t STREET: %s\n\n CITY : %s\n\n PHONE : %s\n\n PATIENT
HISTORY: %s\n\n ROOM NUMBER : %s\n\n DATE OF ADMISSION:%s
",strupr(e.acName),strupr(e.acP_id),strupr(e.acDesiq),e.iAge,strupr(e.acSex),strupr(e
.acStreet),strupr(e.acCity),strupr(e.acPhno),strupr(e.acPhistory),strupr(e.acRoom),st
rupr(e.acDoj));

printf("\n_________________________________________________________________
____\n\n");
 getch(); }
 }
  }
  if(iC==0)
  {
  printf("\n\t\tRECORD DOESN'T EXISTS..");
  getch();
  }iC=0;
  break;
case '3':
  //Searching and modifying Records by id
  cAns='y';
  while(cAns=='y')
  {
  printf("\n\n\n\t\tENTER ID: ");
  scanf("%s",icPid);
  rewind(fp);
  while(fread(&e,lRecsize,1,fp)==1)
  {
  if(strcmp(e.acP_id,icPid)==0)
  {
  b:
  printf("\n\n\t\tENTER NAME: %s : ",strupr(e.acName));
scanf("%s",e.acName);
if(strlen(e.acName)>20||strlen(e.acName)<3)
goto b;
b1:
printf(" \n\t\tENTER SEX : %s : ",strupr(e.acSex));
scanf("%s",e.acSex);
if(strlen(e.acSex)>1)
goto b1;
r:
printf(" \n\t\tENTER AGE: %d : " ,e.iAge);
scanf("%d",&e.iAge);
if(e.iAge<20||e.iAge>65)
goto r;
b3:
printf(" \n\t\tENTER STREET: %s : ",strupr(e.acStreet));
scanf("%s",e.acStreet);
if(strlen(e.acStreet)>30||strlen(e.acStreet)<5)
goto b3;
b4:
printf(" \n\t\tENTER CITY: %s :",strupr(e.acCity));
scanf("%s",e.acCity);
if(strlen(e.acCity)>24||strlen(e.acCity)<3)
goto b4;
a1:
printf(" \n\t\tENTER CONTACT NUMBER: %s :",strupr(e.acPhno));
scanf("%s",e.acPhno);
if(strlen(e.acPhno)>10||strlen(e.acPhno)<10)
goto a1;
if(iCh1==3){
b2:
printf("\n \t\tENTER DESIGNATION: %s : ",strupr(e.acDesiq));
scanf("%s",e.acDesiq);
if(strlen(e.acDesiq)>20||strlen(e.acDesiq)<3)
goto b2;
o:
printf("\n \t\tENTER SALARY: %d :",e.iSal);
scanf("%d",&e.iSal);
if(e.iSal<100||e.iSal>9000)
goto o;
 }

if(iCh1!=3){
b5:
printf("\n \t\tENTER student HISTORY: %s : ",e.acPhistory);
scanf("%s",e.acPhistory);
if(strlen(e.acPhistory)>50)
goto b5;
  }
fseek(fp,-lRecsize,SEEK_CUR); //Repositions the file pointer of a stream
fwrite(&e,lRecsize,1,fp);
printf("\n \t\tRECORD MODIFIED ");
  break;
  }else
  printf("\n \t\tRECORD DOESNT EXISTS ");
  }
  printf("\n\n\n\t\tDO U WANT TO MODIFY ANY RECORD[y/n]");
  /*Flushes a stream On success returns 0 , On error returns EOF */
  fflush(stdin);
  cAns=getche();
  }
  break;
case '4':
 //Searching and deleting records by id
 cAns='y';
 while(cAns=='y')
 {
 printf("\n\n\t\tENTER ID TO DELETE RECORD : ");
 scanf("%s",icPid);
 ft=fopen("temp.dat","wb");
 rewind(fp); //Repositions file pointer to stream's beginning

 while(fread(&e,lRecsize,1,fp)!=0)
 {
 if(strcmp(e.acP_id,icPid)!=0) {
 fwrite(&e,lRecsize,1,ft);
 }
 else {
 iF1=1;
 printf("\n\n\t\t RECORD DELETED SUCCESSFULLY");
  }
 }
 if(iF1!=1){iF1=0;
    printf("\n\n\t\t NO SUCH RECORD FOUND");}
 fclose(fp);
 fclose(ft);
 remove("hp.dat");
 rename("temp.dat","hp.dat");
 fp=fopen("hp.dat","rb+");
 printf("\n\n\t\tDO U WANT TO DELETE ANOTHER RECORD[y/n]");
 fflush(stdin);
 cAns=getche();
 }
  break;
 case '0':
 fclose(fp);
 goto e;
 }
 }
 }
 }
/*******************************************************************
* End of HOSTEL.c
TESTING
Testing is the major control measure used during software development. Its
basic function is to detect errors in the software. During requirement analysis
and design, the output is a document that is usually textual and no executable.
After the coding phase, computer programs are available that can be executed
for testing purpose. This implies that testing not only, has to uncover errors
introduced during coding, but also errors introduced during previous phase.
Thus the goal of testing is to uncover the requirements, design and coding
errors in the programs. So after testing the outputs of my project are as
follows:

Snapshots
FUTURE SCOPE OF THE PROJECT
Our project will be able to implement in future after making some changes
and modifications as we make our project at a very low level. So the
modifications that can be done in our project are: Add one more major change
which can be done in this project is that to add the snaps of the student of
which the record is entered. We can also add or subtract details of the
individual.

				
DOCUMENT INFO
Shared By:
Stats:
views:61
posted:7/12/2012
language:English
pages:20
Description: term paper of computer science on programming in c language