0% found this document useful (0 votes)
15 views7 pages

Student Information System Print PDF

The document describes a student information system project created in Java using OOP concepts like encapsulation, inheritance, and polymorphism. The project uses three classes: Person, Student, and Control. The Person class acts as the parent class with shared properties like name, age, etc. The Student class inherits from Person and contains methods to input and display student data. The Control class acts as the main class and handles user login, entering number of students, and allows interacting with student objects to input, display, and correct data. The classes work together to form an application that manages student records and demonstrates OOP principles.
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)
15 views7 pages

Student Information System Print PDF

The document describes a student information system project created in Java using OOP concepts like encapsulation, inheritance, and polymorphism. The project uses three classes: Person, Student, and Control. The Person class acts as the parent class with shared properties like name, age, etc. The Student class inherits from Person and contains methods to input and display student data. The Control class acts as the main class and handles user login, entering number of students, and allows interacting with student objects to input, display, and correct data. The classes work together to form an application that manages student records and demonstrates OOP principles.
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
You are on page 1/ 7

The Islamia University of

Bahawalpur

OOP Project (Student Information System)


Submitted to:
Mr. Waqas Sharif
Submitted by (Group members):
Muhammad Sufian(S23BDOCS1E02059)
Abdul Aziz(S23BDOCS1E02055)
Muhammad Ahmar(S23BDOCS1E02050)
Hafiz Hammad Saeed(S23BDOCS1E02007)
Section:
BWB-BSCOSC-2nd-1E
Student Information System
We design a Simple JAVA project using OOP concepts named “Student Information System”. In
it we use some of the main concepts like Encapsulation, Inheritance, Polymorphism and
Abstraction. This project really clears our JAVA concepts our doubts and everything.
Our program is not that perfect. But it prompts the user to enter a unique key to execute and
the user loop through the program how many times he wants thanks to do-while loop.
Now coming on our main program here is the code:
Parent class “Person”:
public class Person {
protected String name;
protected String fatherName;
protected int age;
protected String Address;
public Person() {
name = fatherName = Address = null;
age = 0;
}
public void setName(String NM) {
this.name= NM;
}
public String getName() {
return name;
}
public void setFName(String FNM) {
this.fatherName= FNM;
}
public String getFName() {
return fatherName;
}
public void setAge(int age) {
if(age >=0)
this.age = age;
}
public int getAge() {
return age;
}
public void setAddress(String adr) {
this.Address= adr;
}
public String getAddress() {
return Address;
}
public void inputData() {

}
public void display() {

}
}
Inherited from Person class “Student” class:

import java.util.Scanner;
public class Student extends Person {
Scanner scanner = new Scanner(System.in);
public void inputData() {
System.out.print("Entre Name: ");
String name = scanner.nextLine();
setName(name);
System.out.print("Entre Father Name: ");
String Fname = scanner.nextLine();
setFName(Fname);
System.out.print("Entre Age: ");
int age = scanner.nextInt();
setAge(age);
System.out.print("Entre Address: ");
String Addr = scanner.nextLine();
setAddress(Addr);
scanner.nextLine();
}
public void display() {
System.out.println("-------------------------");
System.out.println("Name: "+ getName());
System.out.println("Father Name: "+ getFName());
System.out.println("Age: "+ getAge());
System.out.println("Address: "+ getAddress());
System.out.println("-------------------------");
}
}
Main Class “Control”:

import java.util.*;
public class Control {
private static final String ID = "Sufian";
private static final String PASSWORD = "Sufian123";
private static boolean Validation(String EnterdID, String EnteredPassword) {
if(ID.equals(EnterdID) && PASSWORD.equals(EnteredPassword)) {
return true;
}
else {
return false;
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String repeat;
int repeatDisplay;
System.out.println("Welcome to the Student Information System");
System.out.print("Enter ID: ");
String EnterID = scanner.nextLine();
System.out.print("Enter password: ");
String EnterPassword = scanner.nextLine();
if (Validation(EnterID, EnterPassword)) {
System.out.println("Login successful. Welcome, " + EnterID + "!");
do {
System.out.print("To Start Enter 'Start': ");
String start = scanner.nextLine();
if(start.equalsIgnoreCase("Start")) {
System.out.print("To Entre data press '1': ");
int enter = scanner.nextInt();
System.out.print("Entre Number of Students in your class: ");
int S = scanner.nextInt();
scanner.nextLine();
Person[] S1 = new Person[S];
if(enter == 1) {
for(int i= 0; i< S1.length; ++i) {
S1[i] = new Student();
int a = i+1;
System.out.println("Roll no: “+ a);
S1[i].inputData();
}
do {
System.out.print("To display All Students data press '1'"
+ "\nTo Press '2' to Display with Roll no"
+ "\nPress '3' to Correct Data: ");
int Display = scanner.nextInt();
if(Display == 1) {
for(int i= 0; i< S1.length; ++i) {
S1[i].display();
}
}
else if(Display == 2) {
System.out.print("Entre roll no: ");
int r = scanner.nextInt();
if(r>=1 && r<= S1.length) {
S1[--r].display();
}
}
else if(Display == 3) {
System.out.print("Entre roll no: ");
int c = scanner.nextInt();
if(c>=0 && c<= S1.length) {
S1[--c].inputData();
}
else
System.out.println("Invalid Roll no");
}
System.out.print("Press '0' to Proseed
Further "
+ "Press '1' to Display again: ");
repeatDisplay = scanner.nextInt();
scanner.nextLine();
}
while(repeatDisplay == 1);
}
}
else {
System.out.println("Invalid Command");
}
System.out.print("If you want to Exit Press Yes --> 'Y'"
+ "\n OR To Start over Press No --> 'N': ");
repeat = scanner.nextLine();
scanner.nextLine();
}while(repeat.equalsIgnoreCase("N"));
}
else {
System.out.println("Invalid username or password. Please try again.");
}
scanner.close();
}
}

Explanation:
Our program consists of 3 classes named “Person”, “Student” and main Class “Control”.
Person:
“Person” class is the parent class from which “Student” class is inherited We put Dummy
methods named “inputData” and “display”. Marked the properties as “Protected” as we call
these properties in Student class so its important for us to mark them as “protected”.
Student:
After that in Student class, we place input and Display methods named “inputData” and
“display” respectively.
Control:
After that in main class “Control” we use some static methods in that we use in Log in process
after that we enter no of students from user and set the in Object, we created with Array which
set no of students (Objects).
UML Diagram:

You might also like