0% found this document useful (0 votes)
2 views5 pages

Programming Assignment - Unit 3

The document describes a Java-based console application for managing student records, allowing administrators to add, update, and view student information. It features input validation, error handling, and is designed for small-scale academic record management, supporting up to 1000 students without data persistence. The application runs continuously until the user chooses to exit and requires basic Java knowledge to compile and execute.

Uploaded by

kalolelohh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Programming Assignment - Unit 3

The document describes a Java-based console application for managing student records, allowing administrators to add, update, and view student information. It features input validation, error handling, and is designed for small-scale academic record management, supporting up to 1000 students without data persistence. The application runs continuously until the user chooses to exit and requires basic Java knowledge to compile and execute.

Uploaded by

kalolelohh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CS 1102-01 - AY2026-T4

Programming Assignment - Unit 3


Student Name: Hassan Hamis Hassan
Instructor: Hiralben H Amin
Date: May 01, 2026

For the assignment, the following is the Student Record Management System is a Java-based
console application designed to assist administrators in efficiently managing student information.
It allows users to add, update, and view student records using structured methods and static data
storage. The system emphasizes input validation, error handling, and simplicity, making it a
reliable tool for basic student data management in educational environments. This program stores
student’s information in arrays and has no data persistence.

/* */
import [Link];

public class RobustStudentManagementSystem {


static String[] names = new String[1000];
static int[] ids = new int[1000];
static int[] ages = new int[1000];
static String[] grades = new String[1000];

static int totalStudents = 0;


/*Scanner Object*/
static Scanner input = new Scanner([Link]);
/*Main System*/
public static void main(String[] args) {
int choice;

do {
[Link]("|---------| Student Management System |-----------|");
[Link]("1. Add Student");
[Link]("2. Update Student information");
[Link]("3. View students");
[Link]("4. Exit");
[Link]("Your option: ");

try {
[Link]("Choose option: ");
choice = [Link]();
} catch (Exception e) {

1
[Link]("Invalid input! Enter a number.");
[Link](); // clear bad input
return; // or continue loop
}

switch (choice) {
case 1:
addStudent(); break;
case 2:
updateStudentInformation(); break;
case 3:
viewStudents(); break;
case 4:
[Link]("Exiting.......!");
[Link]("Welcome Again....");
}
} while (choice != 4);
}

static void addStudent() {


if (totalStudents >= 1000) {
[Link]("Storage full..");
return;
}
[Link]("Enter ID: ");
int id;
while (true) {
try {
id = [Link]();
break;
} catch (Exception e) {
[Link]("Invalid ID! Must be a number.");
[Link](); return;
}
}

if (searchStudentByID(id) != -1) {
[Link]("Student with '" + id +"' already exists." );
return;
}

[Link]();

[Link]("Enter name: ");

2
names[totalStudents] = [Link]();
ids[totalStudents] = id;

[Link]("Enter age: ");


ages[totalStudents] = [Link]();

[Link]();

[Link]("Enter Grade: ");


grades[totalStudents] = [Link]();

totalStudents++;

[Link]("'" + names[totalStudents - 1] + "' added successfully..");


}
static void updateStudentInformation(){
[Link]("Enter student ID: ");
int id = [Link]();

int index = searchStudentByID(id);

if (index == -1) {
[Link]("Student not found..");
return;
}

[Link]();

[Link]("Enter new name: ");


names[index] = [Link]();

[Link]("Enter new age: ");


ages[index] = [Link]();

[Link]();

[Link]("Enter new grade: ");


grades[index] = [Link]();

[Link]("Student with ID '" + id + "' updated succesfully..");


}
static void viewStudents() {
if (totalStudents == 0) {
[Link]("No students available..");

3
return;
}

[Link]("\n |---------| Student List |-----------| ");


for (int i = 0; i < totalStudents; i++) {
[Link]("ID: " + ids[i]);
[Link]("Name: " + names[i]);
[Link]("Age: " + ages[i]);
[Link]("Grade: " + grades[i]);
[Link]("-----------------------------------------");
}
}

static int searchStudentByID(int id) {


for (int i = 0; i < totalStudents; i++) {
if (ids[i] == id) {
return i;
}
}
return - 1;
}
}

4
DOCUMENTATION:

The Student Record Management System is a console-based Java application designed to manage
student information efficiently. It uses static arrays to store student data, including name, ID, age,
and grade, and a static counter to track the number of students. The system provides a menu-driven
interface that allows administrators to add new students, update existing records, and view all
student details.
Input validation and exception handling are implemented using loops and try-catch blocks to
ensure the program handles invalid entries without crashing. The application runs in a continuous
loop until the user chooses to exit. It is simple to operate and requires basic knowledge of Java
compilation and execution. This system is suitable for small-scale academic record management.

This program handles up to 1000 students, temporarily, and it based on Console usage, has no
GUI.

To run the program:

1. Install Java Development Kit (JDK) on your device.


2. Save this file as [Link]
3. Compile the program by running javac [Link]
4. Run the program by using java RobustStudentManagementSystem

Usage:
- Choose option from menu (1 ~ 4).
- Enter student details when prompted from the on-screen instructions.

You might also like