Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Admission system project

SHAD SARKAWT SHAWKAT


2019-2020
Contents
Introduction................................................................................................................................................2
Admission system....................................................................................................................................2
What is Java............................................................................................................................................3
What is OOP............................................................................................................................................3
My Parts..................................................................................................................................................3
Inheritance (object-oriented programming)..........................................................................................3
Implementation..........................................................................................................................................4
Application start point.............................................................................................................................4
Add Admin...............................................................................................................................................4
Add Faculty..............................................................................................................................................5
Faculty validation.....................................................................................................................................5
Admin Validation.....................................................................................................................................6
Introduction

This course was one of the most essential ones for us; we managed to cover
many topics related to the course and our education, based on up to date
studies and new researches. The course was both factual and practical and
interesting to pursue and study more. As computer engineers, a good
understanding for the subjects is highly critical. It is also worth mentioning, the
topics were very well-chosen through which we understood different aspects of
the subjects discussed in the course and our future career. In my opinion, the
course was well delivered to us very well both at the beginning of the semester
at university and later when they were switched to online classes. Every lesson
was informative in both curricular matter and teaching methods, and especially
when communication with the teacher was easy and questions were answered
very properly. Throughout this course we gained knowledge, skills and
experiences that we can later employ in our future professions and in life in
general life. Thus, I believe these skills prepared us to take the next step
towards studying more on the subject. And I can confidently say this course was
a big accomplishment for us and our future job.

Admission system
University admission or college admission is the mechanism by which students
in universities and colleges enter tertiary education. Systems vary widely across
continents, and even institution by institution There are autonomous
organizations or government departments in some countries that centralize the
administration of standardized admission exams and the handling of requests.
For several nations, aspiring university students apply for admission to high
school or community college during their last year.
What is Java
Java is a collection of computer software and specifications developed by James
Gosling at Sun Microsystems, later purchased by the Oracle Corporation, which
provides a system for the development and deployment of application software
in a cross-platform computing environment. Java is used in a wide variety of
computing systems, from embedded devices and cell phones to enterprise and
superco servers

What is OOP
Object-oriented programming (OOP) is a programming paradigm based on the
concept of "objects," which may contain data in the form
of fields (often referred to as attributes or properties), and code in the form of
procedures (often referred to as method).
A feature of objects is the procedures of an object that can connect
and often edit the data fields of the object they are associated with

My Parts
My part was working with a login method, I created two users and I stored it in
to array list the users is two types Admin and Faculty , with a user id type of a
user, password and username, so the student will easily sign in, if they are a
faculty member they I did faculty methods if they are an admin they can do
admins functionalities and if they are student they can input their details
without any username and password.

Inheritance (object-oriented programming)


In object-oriented programming, inheritance is the mechanism of basing an
object or class upon another object (prototype-based inheritance) or class
(class-based inheritance), retaining similar implementation
Students Model
Model characterizes an object that holding data and we declare the variables
that store student data and this data can be accessed from the other class so
when we want to store new student, we are storing data inside this model.

public class Student

int id;

double highschool_grade;

String name;

String email;

User Class
This class contain the user login condition and login validation for the and
contain the constructor to exchange data between the main methods and user
class, the constructor inside this hold user data like (username,password,type)
and validate method to validate the login status if the process success return
true otherwise return false.
public class User {

public int id;

public String type;

private String password;

protected String username;

public User(String type,int id,String username,String password) {

this.id=id;

this.type=type;
this.password=password;

this.username=username;

public boolean validate(String username, String password)

if(username.equals(this.username) && password.equals(this.password)) return true;

return false;

Implementation
Application start point we used while as a loop then we take user input throw Scanner as a
string then we used ( if and else ) to separate regular users form admins at the start of the application
it ask the user if they facility or admin in both case it authenticate the user by using function
login_prompt ()

while(true)
{
System.out.printf("\n*****************\n\nAre you a student or faculty or admin?\n");
String ans = input.nextLine().toLowerCase();
if( ans.equals("faculty") )
{
boolean auth = login_prompt("faculty");
if(auth) faculty_interface();
else System.out.printf("\nWrong username or password.\n");
} if ( ans.equals("admin") )
{
boolean auth = login_prompt("admin");
if(auth) admin_interface();
else System.out.println("Wrong username or password.");
}
else {
System.out.printf("\nPlease enter your student details\n");
submit_form( student_reg() );
}
}//while loop [end point

here in class user we initializing user attribute ( id , type of user [admin , faculty] , username
,pass

public class User {


public int id;
public String type;
private String password;
protected String username;

Add Admin

This is where admin user crated first initializing and object then we set attributes like username ,
password ,id

User admin = new User("admin",0,"admin_name","12345");


Then we add the user to our system so they can login later

users.add(admin);
Add Faculty
This is where faculty user crated first initializing and object then we set attributes like username ,
password ,id

User faculty = new User("faculty",1,"faculty_name","12345");


Then we add the user to our system so they can login later

users.add(faculty);

with login_prompt method we separate users this method take one paramatta (type) as a string
then throw scanner, we take user input his credentials then ask for username and password
here separate faculty and admin and return it

public static boolean login_prompt(String type)


{
Scanner input = new Scanner(System.in);

System.out.printf("\nPlease enter your credintials\n");

System.out.print("Username: ");
String username = input.nextLine();

System.out.print("Password: ");
String password = input.nextLine();

if(type.equals("faculty")) return faculty_login(username,password);


else return admin_login(username,password);

}//boolean login_prompt

Faculty validation

This method provides validation and login for faculty return it as ( True or false )
public static boolean faculty_login(String username, String password)
{
for(int i=0;i<users.size();i++)
{
if( users.get(i).validate(username, password) ) return true;
}
return false;
}//Faculty Login

Admin Validation

This method provides validation and login for Admin return it as (True or false)
By taking two attributes username and password use if to check if it is correct then return it as true if
you enter the correct username and password

public static boolean admin_login(String username, String password)


{
for(int i=0;i<users.size();i++)
{
if( users.get(i).validate(username, password) ) return true;
}
return false;
}//Admin Login
Adding Student
This part of code is responsible for inserting new students by calling the students constructor and send
data to student class via this constructor.

Student a = new Student();


a.id=0;
a.email="example@gmail.com";
a.highschool_grade=75;
a.name="example";
students.add(a);

Remove User
This method allow us to delete user by getting their ID as an integer value and using user.remove to
delete that user.

public static User remove_user(int index)


{
User user = users.get(index);
users.remove(index);
return user;
}

View User
By this method we going to display all user data inside the list view like (id,type,username,password)
public static void list_users()
{
System.out.printf("\n\nUsers list:");

for(int i=0;i<users.size();i++)
{
User user = users.get(i);
System.out.printf("\nid: %d | type: %s\nusername: %s\n",user.id,user.type,user.username);
}

You might also like