CS/IT Project: Wisdom College Hostel Management System Implementation

Verified

Added on  2023/03/31

|25
|1266
|447
Project
AI Summary
This document details a C programming project for a hostel management system designed for Wisdom College. The system encompasses several key functionalities, including adding student records, checking room availability based on gender, calculating total payments based on room type and duration of stay, and displaying student details. The code includes functions for adding new student entries to a database, checking room availability in different blocks, calculating the total payment, and displaying student information. The payment section provides different options and allows the user to abort the payment process. The project is designed to manage student accommodation, room allocation, and associated financial transactions within the hostel environment. The provided source code snippets demonstrate the implementation of these features, offering a practical example of how to develop a functional hostel management system using C programming. The project also includes previews of the different functionalities and the source codes of the different functions implemented.
Document Page
Running Head: HOSTEL MANAGEMENT SYSTEM
HOSTEL MANAGEMENT SYSTEM
Name of the Student:
Name of the University:
Author Note:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
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
Document Page
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)
Document Page
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);
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
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);
}
Document Page
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);
}
Document Page
6HOSTEL MANAGEMENT SYSTEM
fclose(ptr);
printf("\nStudent added successfully!\n\n");
}
int gender()
{
char ch;
printf("Enter gender (M/m or F/f): ");
scanf("%c",&ch);
switch(ch)
{
case 'M':
case 'm':{
printf("Available blocks are A3.\n");
printf("Number of available rooms are: 100\n");
break;
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7HOSTEL MANAGEMENT SYSTEM
}
case 'F':
case 'f':{
char choice[2];
printf("Available blocks are B1, B3, B4.\n");
printf("Number of available rooms in B1: 100\n");
printf("Number of available rooms in B3: 100\n");
printf("Number of available rooms in B4: 100\n");
printf("Please choose your block:");
scanf("%s",choice);
if(choice[0]=='B' && choice[1]=='1')
printf("The rates are: Room=400, Meal=120, GYM=10");
else if(choice[0]=='B' && choice[1]=='3')
printf("The rates are: Room=150, Meal=120, GYM=10");
Document Page
8HOSTEL MANAGEMENT SYSTEM
else if(choice[0]=='B' && choice[1]=='4')
printf("The rates are: Room=100, Meal=120, GYM=10");
else
printf("invalid choice");
break;
}
}
printf("\n");
}
Document Page
9HOSTEL MANAGEMENT SYSTEM
Previews:
Fig 1. Add Entry to the list
Check availability of rooms according to gender
The name of this function is gender(), and this function is used to input the gender of the student
and displays the available room options for the student. The character variable ch is used to take
the input of the gender as M/m for male and F/f for female. After that the function moves into the
switch case according to the option chosen.
Source Code to Check availability of rooms according to gender:
int gender()
{
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
10HOSTEL MANAGEMENT SYSTEM
char ch;
printf("Enter gender (M/m or F/f): ");
scanf("%c",&ch);
switch(ch)
{
case 'M':
case 'm':{
printf("Available blocks are A3.\n");
printf("Number of available rooms are: 100\n");
break;
}
case 'F':
case 'f':{
char choice[2];
printf("Available blocks are B1, B3, B4.\n");
printf("Number of available rooms in B1: 100\n");
Document Page
11HOSTEL MANAGEMENT SYSTEM
printf("Number of available rooms in B3: 100\n");
printf("Number of available rooms in B4: 100\n");
printf("Please choose your block:");
scanf("%s",choice);
if(choice[0]=='B' && choice[1]=='1')
printf("The rates are: Room=400, Meal=120, GYM=10");
else if(choice[0]=='B' && choice[1]=='3')
printf("The rates are: Room=150, Meal=120, GYM=10");
else if(choice[0]=='B' && choice[1]=='4')
printf("The rates are: Room=100, Meal=120, GYM=10");
else
printf("invalid choice");
break;
chevron_up_icon
1 out of 25
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]