Attendance Management System
Attendance Management System
Attendance Management System
2. Student Class:
The Student class represents individual students in the system.
It has attributes such as name and rollNumber.
The class includes a constructor to initialize a Student object with
a name and roll number, as well as getter methods to retrieve these
attributes.
3. Methods in AttendanceSystem:
addStudent(): Prompts the user to input the name and roll number
of a student, creates a Student object, and adds it to the array of
students.
removeStudent(): Asks the user for the roll number of the student
to be removed, finds the index of the student in the array, removes
the student if found, and adjusts the array accordingly.
viewStudents(): Displays the list of students currently present in
the system, showing their names and roll numbers.
findStudentIndex(int rollNumber): Searches for a student in the
array based on their roll number and returns the index if found,
otherwise returns -1.
4. Array of Students:
The program maintains an array students to store instances of the
Student class.
The size of the array is set to accommodate a maximum of 60
students (private static Student[] students = new Student[60]).
The variable studentCount keeps track of the number of students
currently stored in the array.
5. Input Validation:
The program validates user input to ensure correctness. For
example, it checks if the entered roll number is valid or if the
student to be removed exists in the system.
6. User Interface:
The user interface is text-based, displaying options and prompts to
the user via the console.
Users interact with the program by entering choices and providing
input when prompted.
Overall, this program provides a simple yet effective way to manage student
attendance data through basic CRUD (Create, Read, Update, Delete) operations.
import java.util.Scanner;
maximum of 60 students
int choice;
do {
System.out.println("4. Exit");
choice = scanner.nextInt();
switch (choice) {
case 1:
addStudent();
break;
case 2:
removeStudent();
break;
case 3:
viewStudents();
break;
case 4:
break;
default:
System.out.println("Invalid Choice!");
scanner.close();
studentCount++;
if (index != -1) {
studentCount--;
} else {
} else {
System.out.println("\nStudent List:");
if (students[i].getRollNumber() == rollNumber) {
return i;
return -1;
class Student {
private String name;
this.name = name;
this.rollNumber = rollNumber;
return name;
return rollNumber;
Output :-
Add Student: Allows users to input the name and roll number of a student and
adds them to the system.
View Students: Displays the list of students currently present in the system, showing their
names and roll numbers.
Remove Student: Enables users to remove a student from the system by entering the roll
number of the student they wish to remove.
Conclusion:-
The Attendance Management System program allows users to
efficiently manage student attendance records. It provides
functionalities such as adding students, removing students, and
viewing the list of students. Through a user-friendly menu interface,
the program ensures ease of use. By implementing object-oriented
principles, it maintains a scalable and organized structure. This
program can be further extended and customized to meet specific
requirements in educational institutions or similar contexts.