This is a simple Student Database Management System implemented in Java. It allows users to perform various operations such as adding students, viewing student details, searching for a student by roll number, calculating the average marks of all students, and exiting the program.
- Add Student: Users can add a new student by providing their name, roll number, age, and marks.
- View Student: Users can view the details of all students currently stored in the database.
- Search Student: Users can search for a specific student by entering their roll number.
- Calculate Average Marks: The system can calculate and display the average marks of all students.
- Exit: Users can choose to exit the program.
-
Compile the Code: Compile the Java file (
Database.java
) using a Java compiler.javac Database.java
-
Run the Program: Execute the compiled Java file.
java Database
-
Follow On-Screen Instructions: Once the program is running, follow the on-screen menu to perform various operations.
- When prompted, enter the corresponding number for the operation you want to perform.
- For adding a student, provide the required details such as name, roll number, age, and marks.
- To view all students, select the option to view students.
- To search for a specific student, enter their roll number.
- The option to calculate average marks will display the average marks of all students stored in the database.
- Choose the exit option to terminate the program.
- This program uses a
HashMap
to store student records. Roll numbers serve as the keys, andStudent
objects are stored as values. - Input is read from the console using the
Scanner
class. - Ensure valid input is provided to avoid unexpected behavior or errors.
'''
- Add Student :
- View Database :
- Search Student (Input roll number) :
- Calculate Average Marks :
- Exit Loop
Enter your choice : 1 Enter student name : John Doe Enter roll number : 101 Enter age : 20 Enter marks : 85.5 Student added successfully!
- Add Student :
- View Database :
- Search Student (Input roll number) :
- Calculate Average Marks :
- Exit Loop
Enter your choice : 2
Student Details: Name: John Doe Roll Number: 101 Age: 20 Marks: 85.5
- Add Student :
- View Database :
- Search Student (Input roll number) :
- Calculate Average Marks :
- Exit Loop
Enter your choice : 4 Average marks is 85.5
'''