logo

Hostel Management System

Developing a hostel management system for Wisdom College in Langkawi to provide accommodation for its students.

25 Pages1266 Words447 Views
   

Added on  2023-03-31

About This Document

This document provides source codes and explanations for a Hostel Management System program. It includes functions for adding student entries, checking room availability based on gender, calculating total payment, checking student details, and managing payment options.

Hostel Management System

Developing a hostel management system for Wisdom College in Langkawi to provide accommodation for its students.

   Added on 2023-03-31

ShareRelated Documents
Running Head: HOSTEL MANAGEMENT SYSTEM
HOSTEL MANAGEMENT SYSTEM
Name of the Student:
Name of the University:
Author Note:
Hostel Management System_1
1HOSTEL MANAGEMENT SYSTEM
Table of Contents
Source Codes...................................................................................................................................2
Add student entry.........................................................................................................................2
Check availability of rooms according to gender........................................................................9
Total payment to be made..........................................................................................................13
Check Student details................................................................................................................15
Payment options and to cancel the payment in mid-way..........................................................19
Hostel Management System_2
2HOSTEL MANAGEMENT SYSTEM
Source Codes
Add student entry
This function is used to add student records to the data file or .dat file that is used in the program.
There are structures made to take input from the user for the date and one for the student details.
The name of the function is new_entry(), the variables that are used is an integer variable named
as choice. FILE defines the two file pointers as *ptr and *hostel.
Source Code to Add student entry:
int new_entry()
{
int choice;
FILE *ptr,*hostel;
ptr=fopen("student_record.dat","a+");
printf("\t\t\t\******* ADD STUDENTS DATA *******\n");
printf("\nEnter student Id:");
scanf("%s",check.student_id);
while(fscanf(ptr,"%s %s %d/%d/%d %d %s %d %s %s %d %s\n",add.student_id, add.name,
&add.dob.month, &add.dob.day, &add.dob.year, &add.age, add.city, &add.phone, add.mail_id,
add.father_name, &add.father_phone, add.hostel_name)!=EOF)
Hostel Management System_3
3HOSTEL MANAGEMENT SYSTEM
{
if (strcmp(check.student_id,add.student_id)==0)
{printf("Students Id already in use!");
goto student_id;
}
}
strcpy(add.student_id,check.student_id);
printf("\nEnter the name:");
scanf("%s",add.name);
printf("\nEnter the date of birth(mm/dd/yyyy):");
scanf("%d/%d/%d",&add.dob.month,&add.dob.day,&add.dob.year);
printf("\nEnter the age:");
scanf("%d",&add.age);
printf("\nEnter the city:");
scanf("%s",add.city);
printf("\nEnter the phone number: ");
scanf("%d",&add.phone);
Hostel Management System_4
4HOSTEL MANAGEMENT SYSTEM
printf("\n Enter your email id :");
scanf("%s",add.mail_id);
printf("\n Enter your Father's name:");
scanf("%s",add.father_name);
printf("\n Enter your Father's phone no.:");
scanf("%d",&add.father_phone);
printf("\n Enter your hostel name from A3, B1, B3, B4 :");
scanf("%s",add.hostel_name);
fprintf(ptr,"%s %s %d/%d/%d %d %s %d %s %s %d %s %s\n",add.student_id, add.name,
add.dob.month, add.dob.day, add.dob.year, add.age, add.city, add.phone, add.mail_id,
add.father_name, add.father_phone, add.hostel_name);
//adding student Ids to hostels' list
if(strcmp(add.hostel_name,"A3")==0)
{
hostel=fopen("A3.dat","a+");
fprintf(hostel, "%s\n", add.student_id);
fclose(hostel);
}
Hostel Management System_5
5HOSTEL MANAGEMENT SYSTEM
else if(strcmp(add.hostel_name,"B1")==0)
{
hostel=fopen("B1.dat","a+");
fprintf(hostel, "%s\n", add.student_id);
fclose(hostel);
}
else if(strcmp(add.hostel_name,"B3")==0)
{
hostel=fopen("B3.dat","a+");
fprintf(hostel, "%s\n", add.student_id);
fclose(hostel);
}
else if(strcmp(add.hostel_name,"B4")==0)
{
hostel=fopen("B4.dat","a+");
fprintf(hostel, "%s\n", add.student_id);
fclose(hostel);
}
Hostel Management System_6

End of preview

Want to access all the pages? Upload your documents or become a member.