Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 209 additions & 0 deletions Hostel Management/Hostel-Management-main/Admin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
package definition;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedHashSet;
public class Admin {
LinkedHashSet<Student> hs ;
Room r= new Room() ;
SubmitAttendance sa=new SubmitAttendance();
public Admin(LinkedHashSet<Student> hs,Room r, SubmitAttendance sa)
{
this.hs=hs;
this.r=r ;
this.sa=sa;
}
public boolean login() throws IOException
{
String name="a";
String pass="a";
String u_name;
String u_pass;
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("Enter username");
u_name=br.readLine();
System.out.println("Enter password");
u_pass=br.readLine();
if(u_name.compareTo(name)==0 && u_pass.compareTo(pass)==0)
{
return true;
}
else
{
return false;
}
}
public int menu() throws IOException
{
int choice=0;
do
{
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("Enter your choice");
System.out.println("1.Display all records");
System.out.println("2.Display vacancy");
System.out.println("3.Display attendance");
System.out.println("4.Search record");
System.out.println("5.Fee paid status");
System.out.println("0. Exit");
try
{
choice=Integer.parseInt(br.readLine());
}
catch(NumberFormatException e)
{
System.out.println("Please enter a valid number");
choice=-1;
}
}while(choice < 0 || choice > 5 );
return choice;
}
public void call_menu() throws IOException
{
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
int choice =0 ;
int flag=0;
int id=0;
do
{
choice = menu();
switch(choice)
{
case 1:
if (hs.isEmpty())
{
System.out.println("No records found");
break ;
}
for(Student b:hs)
{
System.out.println(b.id+" "+b.name+" "+b.roomno+" "+b.fees+" "+b.mobile_no);
}
break ;
case 2:
r.displayAllRoomDetails();
break ;
case 3 :
if (hs.isEmpty())
{
System.out.println("No records found");
break ;
}
System.out.println("Enter id: ");
flag=0;
do
{
try
{
id=Integer.parseInt(br.readLine());
flag=1;
}
catch(NumberFormatException e)
{
System.out.println("Invalid id");
System.out.println("Please enter correct id again");
}
}while(flag!=1);

sa.bdisplayAttendance(id);
break ;
case 4:
if (hs.isEmpty())
{
System.out.println("No records found");
break ;
}
System.out.println("Enter id: ");
flag=0;
do
{
try
{
id=Integer.parseInt(br.readLine());
flag=1;
}
catch(NumberFormatException e)
{
System.out.println("Invalid id");
System.out.println("Please enter correct id again");
}
}while(flag!=1);
displayById(id);
break;
case 5:
if (hs.isEmpty())
{
System.out.println("No records found");
break ;
}
int fchoice=0;
do
{
System.out.println("Enter choice:\n1: Students who have paid the fees");
System.out.println("2: Students who have not paid the fees");
try
{
fchoice=Integer.parseInt(br.readLine());
}
catch(NumberFormatException e)
{
System.out.println("Please enter a valid number");
fchoice=-1;
}
}while(fchoice < 1 || fchoice > 2 );
displayFeeStatus(fchoice);
break;
case 0:
break ;
}
}while(choice!=0);
}

public void displayById(int id_check)
{
int flag=0;
for(Student b:hs)
{
if(id_check==b.id)
{
System.out.println(b.id+" "+b.name+" "+b.roomno);
System.out.println("Total fees 1,00,000\nFees paid : "+b.fees+" Fees remaining :"+(100000-b.fees));
flag=1;
break ;
}
}
if(flag!=1)
{
System.out.println("Record not found");
}
}

public void displayFeeStatus(int fchoice)
{
if(fchoice==1)
{
System.out.println("Name\tStatus");
for(Student b:hs)
{
if(b.fees==100000f)
{
System.out.println(b.name+"\tPaid");
}
}
}
else if(fchoice==2)
{
System.out.println("Name\tTotal Fees\tFees Paid\tFees Remaining");
for(Student b:hs)
{
if(b.fees!=100000f)
{
System.out.println(b.name+"\t1,00,000\t"+b.fees+"\t\t"+(100000-b.fees));
}
}
}
}
}
27 changes: 27 additions & 0 deletions Hostel Management/Hostel-Management-main/Attendance.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package definition;
import java.util.ArrayList;

public class Attendance {
ArrayList<Integer> att1= new ArrayList<Integer>();

public void giveAttendance(int date)
{
att1.add(date);
}

public void display()
{
int i=0;
for(i=1;i<=31;i++)
{
if(att1.contains(i))
{
System.out.println("Day: "+(i)+" Record: Present");
}
else
{
System.out.println("Day: "+(i)+" Record: Absent");
}
}
}
}
53 changes: 53 additions & 0 deletions Hostel Management/Hostel-Management-main/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Hostel-Management
For the past few years, the number of educational institutions is increasing rapidly. Thereby the number of hostels is also increasing for the accommodation of the students
studying in this institution. And hence there is a lot of strain on the person who is running the hostel and software is not usually used in this context.
This particular project deals with the problems of managing a hostel and avoids the problems which occur when carried manually. Hence reduces the load on the person
handling this. It deals with the following problems:

• Time consuming

• Human error

• Slow process

• Poor quality

• Data inconsistency

• The process of maintaining records of students is manual and time-consuming

• Maintaining attendance and fee status is difficult

• Checking vacancy in a hostel is a bit tedious if all the process is handwritten

• Getting a summary of all records is also not possible in a traditional record-keeping system

• The chances of occurring errors are more. So the records must be accurate, informative, and dynamically updated.

We have designed a Hostel Management System which can be used by Hostels for keeping a track of all the students present in the hostel.
Nowadays, all the records in hostels are handwritten and maintained in registers which is not feasible in the long run. If you want to look for a record of a specific student
you would have to spend hours looking through papers.

We have made work tremendously easier, all you have to do is to enter the id of the student and all the details will be displayed to you within a second.
We have accomplished this by using data structures, algorithms, and numerous input validations.

Data Structures Used:
LinkedHashSet:

We wanted Fast searching and Insertion, also we had a large amount of data and we wished to maintain insertion order.
So we went for LinkedHashSet which has a O(1) time complexity.


ArrayList:
Java ArrayList class uses a dynamic array for storing the elements. It is like an array, but there is no size limit.
We can add or remove elements anytime . Methods of arraylist are non-synchronized which implies at a time multiple threads are allowed and hence provides high performance

Sites/Books used for reference:

GeeksForGeeks
StackOverflow
Big JAVA
W3Schools
Tutorialspoint
Javatpoint
JAVA Documentation
31 changes: 31 additions & 0 deletions Hostel Management/Hostel-Management-main/Room.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package definition;
public class Room
{
int arr[] =new int[10] ;
public Room()
{

}
public boolean allot(int roomno)
{
if(arr[roomno-1]<3)
{
arr[roomno-1]++;
return true;
}
else if(arr[roomno-1]>=3)
{
System.out.println("Sorry, this room is full. Please enter another room no");
}
return false;
}
public void displayAllRoomDetails()
{
System.out.println("Room No No of occupants Vacancy");
for(int i=0 ;i<10 ;i++)
{
System.out.println((i+1)+"\t "+arr[i]+"\t "+(3-arr[i]));
}
}

}
Loading