flihuhgurhug

download flihuhgurhug

of 59

Transcript of flihuhgurhug

  • 7/29/2019 flihuhgurhug

    1/59

    Design and Implementation of aStudent Enrolment System using Java and JDBC

  • 7/29/2019 flihuhgurhug

    2/59

    2

    Abstract

    Student Enrolment System is application software that enables an educational institution

    to Enroll and keep a record of its Students as well as Lecturer. In addition to this the

    application provides a tool to maintain the records of the programmes and courses offered

    by the institution. The application is password protected that enables only the authorized

    personnel to use it.

    The system initiates with the Login form which requires the user to enter valid username

    and password. If in case, the user enters an incorrect username or password the system

    will not open. On entering correct username and password the system takes the user to

    the Main form. The Main form consists of several buttons such as Student Functions,

    Programme Functions, Lecturer Functions, Course Functions and Enroll Student which

    are linked to their respective forms. So when the user clicks on any of these buttons it will

    open that particular form which can further be used by the user to perform the respective

    operations. The system allows user to insert and save Student, Programme, Lecturer,

    Course and Enrolment details which can be retrieved, updated or deleted by the user as

    and when required. After the user has finished working on the system, the user can click

    on Exit button which will close the system and automatically display the login form.

    The system is user friendly and can be used by any user, i.e. any educational institutionwithout prior knowledge of the system. The save and search feature of the system are

    easy to use and allows the user to keep a track of the data which was saved previously.

  • 7/29/2019 flihuhgurhug

    3/59

    3

    Table of Contents

    1 Introduction ..................................................................................................... 51.1 Background.............................................................................................. 51.2 Roadmap of the Report............................................................................ 5

    2 Requirement Analysis and Specification ......................................................... 7

    2.1 Backbone of the project ........................................................................... 72.2 Requirement of the System...................................................................... 72.3 Analysis of the languages available ......................................................... 72.4 Advantages of Java.................................................................................. 82.5 Analysis of the project .............................................................................. 8

    3 Design ........................................................................................................... 113.1 Analysis of Various design ..................................................................... 113.2 Features of design ................................................................................. 12

    3.2.1 Login Form...................................................................................... 123.2.2 Main Form....................................................................................... 133.2.3 Student Form .................................................................................. 14

    3.2.4 Programme Form............................................................................ 153.2.5 Lecturer Form ................................................................................. 163.2.6 Course Form................................................................................... 173.2.7 Enroll Form ..................................................................................... 18

    4 Implementation.............................................................................................. 204.1 Introduction ............................................................................................ 204.2 JDBC Connection Code......................................................................... 204.3 Code for Login Button ............................................................................ 214.4 Code for Main Form ............................................................................... 224.5 Code for Save Button............................................................................. 234.6 Code for Clear Button ............................................................................ 254.7 Code for Search Button.......................................................................... 264.8 Code for Update Button ......................................................................... 274.9 Code for Delete Button........................................................................... 294.10 Code for Close Button............................................................................ 30

    5 Testing .......................................................................................................... 315.1 Format of Testing ................................................................................... 315.2 Login Form Testing ................................................................................ 315.3 Main Form Testing ................................................................................. 335.4 Student Form Testing............................................................................. 345.5 Programme Form Testing ...................................................................... 40

    5.6 Lecturer Form Testing............................................................................ 455.7 Course Form Testing ............................................................................. 505.8 Enroll Form Testing................................................................................ 55

    6 Critical Appraisal ........................................................................................... 576.1 Introduction ............................................................................................ 576.2 Discussion of Analysis ........................................................................... 576.3 Discussion of Design.............................................................................. 576.4 Discussion of Implementation ................................................................ 586.5 Discussion of Testing ............................................................................. 586.6 Areas of Improvement............................................................................ 586.7 Lessons learnt during the project ........................................................... 58

  • 7/29/2019 flihuhgurhug

    4/59

    4

    Table of Figures

    Figure 1 - Use Case Diagram................................................................................. 9Figure 2 - Class Diagram...................................................................................... 10Figure 3 - Entity Relationship Diagram................................................................. 19

  • 7/29/2019 flihuhgurhug

    5/59

    5

    1 Introduction

    1.1 Background

    This project is about the design and implementation of a software application for storing,

    retrieving, updating and deleting records of the Student Enrolment using Java and

    Microsoft Access Databases and outputting the results in the forms of displayed outputs

    on the screen. It will involve storing, retrieving, updating and deleting records of the

    students, lecturers and various courses and programmes offered by the educational

    institution pertaining to table schemas, table names, types of tables and column names

    associated with each table.

    From the very onset of my Database System Module, it has had a strong influence on myinterest in developing a data-driven Student Enrolment System. In this system, records

    entered by the user will be stored in a database which can later be retrieved, updated and

    deleted by the college as and when required. An initial research revealed that it is possible

    to develop such a system through a database APIs such as Java Database Connectivity

    (JDBC). In the testing section of this report, I have tested the system and successfully

    demonstrated the working of each and every feature offered by the system. I have studied

    Java in the past years, which developed an interest in applying the knowledge that I have

    gained over the years. This project enables me to practically apply and test my knowledgein this area. Again, a Student Enrolment System gives me an opportunity to test my

    practical skills by developing a project that is real which means the output will be able to

    do a real job for other users. However, I believe that this application can be enhanced

    further to be used in a more advanced Student Enrolment System which will have even

    more features in addition to those offered by the system.

    1.2 Roadmap of the Report

    The Requirement analysis and specification chapter of this report describes the backbone

    of the project. It describes in detail the requirements which were needed and used in the

    development of the system. Further more, it explains the analysis of the variety of the

    languages available and the justification to the selection of Java as a language to develop

    the system. It contains an in-depth analysis of the project. The use of Netbeans is justified

    to the fact that it offers a variety of tools to develop any system. To conclude, the use of

    Unified Modelling Language is explained.

  • 7/29/2019 flihuhgurhug

    6/59

    6

    The Design chapter of this report explains briefly the various designs that were thought of

    in order to develop a system. In addition to this, it explains in full detail various features of

    the design selected to develop the system. The Entity relationship diagram attached in the

    design section will further clarify the image of the design that has been thought of to

    develop the system.

    The Implementation chapter of this report explains in details how the design was

    developed into real life software using Java and JDBC. This portion of this report will

    throw a light on the coding that was developed to bring to life Student Enrolment System.

    The most important part of the report is the Testing chapter. This chapter of the report has

    successfully demonstrated the working of this system. Data has been inserted on a

    random basis in order to prove the successful working of the system. This part contains

    snapshots of the system with the random information that was inserted. To add to this,

    snapshots of the database are also provided.

    To conclude this report, a critical appraisal has been given. This part of the report covers

    all the aspects that are explained above plus the lessons that were learnt during the

    development of this project. It also suggests further improvements to the project which

    can improve working of the system to an advanced level.

  • 7/29/2019 flihuhgurhug

    7/59

    7

    2 Requirement Analysis and Specification

    2.1 Backbone of the project

    To investigate various ways of entering, updating, displaying, and deleting data from a

    database using Java Netbeans and Microsoft Access 2003 using (JDBC), with the view of

    subsequent analysis and design to derive software requirements and design specification

    for building a Student Enrolment System;

    2.2 Requirement of the System

    The system requires the user to insert information regarding Student, Programme,

    Lecturer, Course and Enroll Student. This information needs to be saved or updated bythe user. The entries which are not require any more are to be deleted by the user.

    These functional requirements are result of the research that I have done on the Student

    Enrolment System that are adopted by the various educational systems around the world.

    The system that educational institutions use these days are very advanced, secured and

    reliable. Taking a lot of motivation from these systems, I have attempted to develop a

    basic Student Enrolment System. I am completely aware of the fact that the system I may

    develop will not contain the most extraordinary and latest features. But my target is to

    achieve realistic application software that can work in real life on the real life problems that

    institutions face in their day to day schedule.

    2.3 Analysis of the languages available

    There has been a dramatic revolution with the onset of the 21st century in the manner of

    which application software are developed. A wide range of languages are available for

    developing application software. Java, Visual Basic, C++, C# are few examples of such

    languages. Each of these languages is useful and advantageous in its own manner. Two

    most widely used languages are Java and Visual Basic. Java is the most widely used

    language.

  • 7/29/2019 flihuhgurhug

    8/59

    8

    2.4 Advantages of Java

    There are number of advantages of using Java as a language for developing application

    software;

    Java is Object oriented language

    Java is Platform Independent

    Java is Multithreaded, Robust

    Java is Secure

    http://www.webdotdev.com/nvd/articles-reviews/java/java-advantages-and-disadvantages-1042.html

    2.5 Analysis of the project

    A Student Enrolment System was developed using Java. There are several Java based

    softwares available for the development of the system. A Netbeans is one such Java

    based software which can be used to develop this system. The Netbeans IDE has many

    features and tools for each of the Java platforms. Netbeans offer several benefits to the

    developer. The Palette offered by Netbeans has been made use of extensively in this

    project. The main feature of Palette that has been used in this project is Swing Controls.

    This Swing Controls includes labels, Textboxes, Password fields, Combo-Box, Buttons

    any many more features which can be used to design the forms very easily and quickly.

    Netbeans offer Source package and libraries in itself which makes the user easy to create

    project. These great features made me to choose Netbeans to develop my project.

    This project is developed using Unified Modelling Language (UML) method. The UML is

    used to specify, visualize, modify, construct and document the artefacts of an object

    oriented software intensive system under development. The UML method gives an idea of

    the development of the system to the developer. I have used UML as method of

    development because it makes the task of developing the system easy in the sense thatthe whole picture of the system is made clear in the mind of the developer.

    http://java.sun.com/developer/onlineTraining/tools/netbeans_part1/#features

  • 7/29/2019 flihuhgurhug

    9/59

    9

    System

    Administrator

    Login System

    Add Student

    Search Student

    Update Student

    Delete Student

    Add Programme

    Search Programme

    Update Programme

    Delete Programme

    Add Lecturer

    Search Lecturer

    Update Lecturer

    Delete Lecturer

    Add Course

    Search Course

    Update Course

    Delete Course

    Enroll Student

    Figure 1 - Use Case Diagram

  • 7/29/2019 flihuhgurhug

    10/59

    10

    Student

    -Pk_Student No-First Name-Last Name

    -DOB-Gender-Address-Email-Mobile-Nationality

    -Save New Student()-Clear Student Details()-Search by Student No()-Update Existing Student()

    -Delete Existing Student()-Close Student form()

    Programme

    -Pk_Programme No-Title-Level

    -Save New Programme()-Clear Programme Details()-Search by Programme No()-Update Existing Programme()-Delete Existing Programme()-Close Programme Form()

    Lecturer

    -Pk_Lecturer No-First Name-Last Name

    -Email-Mobile

    -Save New Lecturer()-Clear Lecturer Details()-Search by Lecturer No()-Update Existing Lecturer()-Delete Existing Lecturer()-Close Lecturer Form()

    Course

    -Pk_Course No-Course Name-Semester Duration-Fk_Programme No-Fk_Lecturer No

    -Save New Course()-Clear Course Details()-Search by Course No()-Update Existing Course()-Delete Existing Course()-Close Course Form()

    Enroll

    -Fk_Student No-Fk_Course No-Enrolment Date-Semester Duration

    -Enroll New Student()-Close Enroll Form()

    Login

    -Username-Password

    -Login System()-Close Login Form()

    Main Form

    -Student Function()-Programme Functions()-Lecturer Functions()-Course Functions()-Enroll Student()

    -Exit Main Form()

    Figure 2 - Class Diagram

  • 7/29/2019 flihuhgurhug

    11/59

    11

    3 Design

    3.1 Analysis of Various design

    There were two alternatives for Input, Output, and Graphical User Interface (GUI). One

    such alternative was using GUIGenie software tool which is used to design forms. This

    software allows developer to drag and drop components like Label, Textbox, Buttons

    which generates code of the design which can later on be copied and pasted in the Java

    file and can be debugged to get the output in the form of screens. But if the developer

    needs to make some changes in the design it would not be possible for the developer to

    make any alterations in the design itself without going back to GUIGenie. On the contrary,

    another alternative was Netbeans software which has Palette toolbox readily available

    used to design forms. This palette includes Swing Controls which has Labels, Textboxes,

    Password fields, Buttons, Check-box, Radio button and many more features which can be

    drag and drop in the forms. So there is no need to copy any code from one software to

    another. This is the most advanced benefit of Netbeans that made me to choose it as

    developing software.

    A number of design models were planned before coming to this particular design. One of

    such design was thought of where by a secure login was required before any form was

    opened. On analysing the consequences of this, where a user was required to rememberand input many username and password, the idea was eliminated. But taking into

    consideration the security of the user are universal username and password is required

    before the main form opens. Any further work on this system will not require any

    authentication following the first login.

  • 7/29/2019 flihuhgurhug

    12/59

    12

    3.2 Features of design

    3.2.1 Login Form

    This Login Form will ask the user to enter Username and Password, If the user enters

    correct username and password system will allow user to go to the Main form of the

    system. But if user enters wrong username and password then the system will show

    Invalid Username and Password message.

  • 7/29/2019 flihuhgurhug

    13/59

    13

    3.2.2 Main Form

    The Main Form contains Student Functions, Programme Functions, Lecturer Functions,

    Course Functions, Enroll Student and Exit Buttons which are linked respectively to their

    forms including an image which looks attractive.

  • 7/29/2019 flihuhgurhug

    14/59

    14

    3.2.3 Student Form

    This form enables user to enter and save information like StudentNo, FirstName,

    LastName, Date of Birth, Gender, Address, Email, Mobile and Nationality of the student

    which can be searched, updated and deleted when required using their respective buttons.

    A unique feature of the design of the student form is that when a user opens student form

    for the first time only Save, Clear, Search buttons will be active. Update and Delete

    buttons which are irrelevant at this moment will be inactive. These buttons will be

    activated only when information is searched. Search can be done by StudentNo only.

    While searching, if the search is invalid it will give a message Please enter correct

    StudentNo to Search. On the other hand, If the search is valid it will retrieve data from the

    database and display it on the screen which can further be updated or deleted.

    At any stage if the input information needs to be altered, Clear button enables the user to

    clear all the fields. Student form has Combo box for Gender which will be helpful for the

    user to select from the list either Male or Female, so that no other information can be

    inserted apart from this. Lastly, Close button hide Student form and takes the user to the

    Main form.

  • 7/29/2019 flihuhgurhug

    15/59

    15

    3.2.4 Programme Form

    This form enables user to enter and save information like ProgrammeNo, Title, Level, of

    the Programme which can be searched, updated and deleted when required using their

    respective buttons.

    A unique feature of the design of the Programme Form is that when a user opens

    Programme Form for the first time only Save, Clear, Search buttons will be active. Update

    and Delete buttons which are irrelevant at this moment will be inactive. These buttons will

    be activated only when information is searched. Search can be done by ProgrammeNo

    only. While searching, if the search is invalid it will give a message Please enter correct

    ProgrammeNo to Search. On the other hand, If the search is valid it will retrieve data

    from the database and display it on the screen which can further be updated or deleted.

    At any stage if the input information needs to be altered, Clear button enables the user to

    clear all the fields. Lastly, Close button hide Programme form and takes the user to the

    Main form.

  • 7/29/2019 flihuhgurhug

    16/59

    16

    3.2.5 Lecturer Form

    This form enables user to enter and save information like LecturerNo, FirstName,

    LastName, Email, Mobile of the Lecturer which can be searched, updated and deleted

    when required using their respective buttons.

    A unique feature of the design of the Lecturer Form is that when a user opens Lecturer

    Form for the first time only Save, Clear, Search buttons will be active. Update and Delete

    buttons which are irrelevant at this moment will be inactive. These buttons will be

    activated only when information is searched. Search can be done by LecturerNo only.

    While searching, if the search is invalid it will give a message Please enter correct

    LecturerNo to Search. On the other hand, If the search is valid it will retrieve data from

    the database and display it on the screen which can further be updated or deleted.

    At any stage if the input information needs to be altered, Clear button enables the user to

    clear all the fields. Lastly, Close button hide Lecturer form and takes the user to the Main

    form.

  • 7/29/2019 flihuhgurhug

    17/59

    17

    3.2.6 Course Form

    This form enables user to enter and save information like CourseNo, CourseName,

    SemesterDuration, ProgrammeNo, LecturerNo of the Course which can be searched,

    updated and deleted when required using their respective buttons.

    A unique feature of the design of the Course Form is that when a user opens Course

    Form for the first time only Save, Clear, Search buttons will be active. Update and Delete

    buttons which are irrelevant at this moment will be inactive. These buttons will be

    activated only when information is searched. Search can be done by CourseNo only.

    While searching, if the search is invalid it will give a message Please enter correct

    CourseNo to Search. On the other hand, If the search is valid it will retrieve data from the

    database and display it on the screen which can further be updated or deleted.

    At any stage if the input information needs to be altered, Clear button enables the user to

    clear all the fields. Course form has Combo box for Semester Duration which will be

    helpful for the user to select from the list either 1 or 2, so that no other information can

    be inserted. Apart from this Course form also has Combo box for Programme No and

    Lecturer No which can be retrieved from their respective database. Lastly, Close button

    hide Course form and takes the user to the Main form.

  • 7/29/2019 flihuhgurhug

    18/59

    18

    3.2.7 Enroll Form

    This form enables user to select Student No, Course No from Combo box which is linked

    to the Student and Course database and then enter Enrolment Date manually and Select

    Semester Duration from the Combo box and Enroll a student by using Enroll Button.

    Lastly, Close button hide Enroll Student form and takes the user to the Main form.

  • 7/29/2019 flihuhgurhug

    19/59

    19

    Figure 3 - Entity Relationship Diagram

  • 7/29/2019 flihuhgurhug

    20/59

    20

    4 Implementation

    4.1 Introduction

    This product is developed in Java Netbeans using JDBC. Netbeans have palette toolbox

    readily available to design forms using JDK 1.6 Platform environment set default byNetbeans itself. This project is designed with Login Form, Main Form, Student Form,

    Programme Form, Lecturer Form, Course Form and Enroll Form. All these forms have

    almost same coding for Save, Clear, Search, Update, Delete and Close. To demonstrate

    working of this project, below is the list of Coding.

    4.2 JDBC Connection Code

    To demonstrate this project user must connect JDBC connection in their computer by

    giving Data Source Name as studentdsn and then run the project.

    public Student()throws ClassNotFoundException, SQLException {

    initComponents();

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

    con = DriverManager.getConnection("jdbc:odbc:studentdsn", "", "");

    String str = "select * from Student";

    stmt =

    con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPD

    ATABLE);

    pstmt=con.prepareStatement(str);

    rs=pstmt.executeQuery();

    jbtn_update.setEnabled(false);

    jbtn_delete.setEnabled(false);

    }

  • 7/29/2019 flihuhgurhug

    21/59

    21

    4.3 Code for Login Button

    Taking example of the Login Form here is the code for Login Button which allows user to

    go to the Main form.

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

    // TODO add your handling code here:

    try {

    String user = jtxt_username.getText();

    String password = jPasswordField1.getText();

    //if((user == rs.getString("username")) && (password ==

    rs.getString("password")))

    if(user.equals("") && password.equals(""))

    {

    JOptionPane.showMessageDialog(null,"Please Enter Username &

    Password.");

    }

    else{

    if(user.equals("admin") && password.equals("admin")) {

    MainForm mf = new MainForm();

    mf.show();

    this.hide();

    }

    else {

    JOptionPane.showMessageDialog(null,"Invalid Username & Password");

    jtxt_username.getFont();jtxt_username.setText("");

    jPasswordField1.setText("");

    }

    }

    } catch(Exception ex) {

    ex.printStackTrace();

    }

    }

  • 7/29/2019 flihuhgurhug

    22/59

    22

    4.4 Code for Main Form

    The Main Form contains several buttons out of which one is Student Functions. When the

    user clicks on Student Function button system will take user to the Student Form. Sample

    code for Student Function button is shown below;

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

    // TODO add your handling code here:

    Student std;

    try {

    std = new Student();

    std.show();

    this.hide();

    } catch (ClassNotFoundException ex) {

    Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);

    } catch (SQLException ex) {

    Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);

    }

    }

  • 7/29/2019 flihuhgurhug

    23/59

    23

    4.5 Code for Save Button

    Almost all the forms contain Save button. Here is one example of Save button code from

    the Student Form.

    private void jbtn_saveActionPerformed(java.awt.event.ActionEvent evt) {

    // TODO add your handling code here:

    String strrr = "select * from Student";

    try {

    stmtt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,

    ResultSet.CONCUR_UPDATABLE);

    pstmtt=con.prepareStatement(strrr);

    rss=pstmtt.executeQuery();} catch (SQLException ex) {

    Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);

    }

    int flag=1;

    try {

    while(rss.next())

    {

    if(jTextField1.getText().equals(rss.getString(1)))

    {

    JOptionPane.showMessageDialog(null,"StudentNo already exists");

    flag=0;

    }

    }

    if(flag==1)

    {

    String strr="insert into

    Student(StudentNo,Firstname,Lastname,DOB,Gender,Address,Email,Mobile,Nationality)

    values(?,?,?,?,?,?,?,?,?)";

    pstmtt = con.prepareStatement(strr);

    pstmtt.setString(1,jTextField1.getText());

    pstmtt.setString(2,jTextField2.getText());

    pstmtt.setString(3,jTextField3.getText());

  • 7/29/2019 flihuhgurhug

    24/59

    24

    pstmtt.setString(4,jTextField4.getText());

    pstmtt.setString(5, (String) jComboBox1.getSelectedItem());

    pstmtt.setString(6,jTextField6.getText());

    pstmtt.setString(7,jTextField7.getText());

    pstmtt.setString(8,jTextField8.getText());

    pstmtt.setString(9,jTextField9.getText());

    int a = pstmtt.executeUpdate();

    JOptionPane.showMessageDialog(null,"Data has been Saved");

    jTextField1.setText("");

    jTextField2.setText("");

    jTextField3.setText("");

    jTextField4.setText("");jComboBox1.setSelectedItem("");

    jTextField6.setText("");

    jTextField7.setText("");

    jTextField8.setText("");

    jTextField9.setText("");

    }

    } catch (SQLException ex) {Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);

    }

    }

  • 7/29/2019 flihuhgurhug

    25/59

    25

    4.6 Code for Clear Button

    Almost all the forms contain Clear button. Here is one example of Clear button code from

    the Student Form.

    private void jbtn_clearActionPerformed(java.awt.event.ActionEvent evt) {

    // TODO add your handling code here:

    jTextField1.setText("");

    jTextField2.setText("");

    jTextField3.setText("");

    jTextField4.setText("");

    //jTextField5.setText("");

    jComboBox1.setSelectedItem("");

    jTextField6.setText("");jTextField7.setText("");

    jTextField8.setText("");

    jTextField9.setText("");

    }

  • 7/29/2019 flihuhgurhug

    26/59

    26

    4.7 Code for Search Button

    Almost all the forms contain Search button. Here is one example of Search button code

    from the Student Form.

    private void jbtn_searchActionPerformed(java.awt.event.ActionEvent evt) {

    // TODO add your handling code here:

    try {

    Statement stmt=null;

    String srch="select * from Student where StudentNo= '"+jTextField1.getText()+"'";

    stmt = con.createStatement();

    rs=stmt.executeQuery(srch);

    if(rs.next()){

    jTextField1.setText(rs.getString(1));

    jTextField2.setText(rs.getString(2));

    jTextField3.setText(rs.getString(3));

    jTextField4.setText(rs.getString(4));

    jComboBox1.addItem(rs.getString(5));

    jTextField6.setText(rs.getString(6));

    jTextField7.setText(rs.getString(7));

    jTextField8.setText(rs.getString(8));

    jTextField9.setText(rs.getString(9));

    }

    //else if(!(jTextField1.equals(rs.getString(1))))

    //{

    // JOptionPane.showMessageDialog(null, "student rollno is not exist");

    // }

    else

    {

    JOptionPane.showMessageDialog(null, "Please Enter StudentNo to Search");

    }

    }

    catch (SQLException ex) {

    Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);

    }

    }

  • 7/29/2019 flihuhgurhug

    27/59

    27

    4.8 Code for Update Button

    Almost all the forms contain Update button. Here is one example of Update button code

    from the Student Form.

    private void jbtn_updateActionPerformed(java.awt.event.ActionEvent evt) {// TODO add your handling code here:

    try {

    int i =1;

    while(rs.next())

    {

    if(jTextField1.getText().equals(rs.getString(1)))

    {

    JOptionPane.showMessageDialog(null,"StudentNo already exists");

    i = 0;

    }

    }

    if(i==1)

    {

    String updt="update Student set Firstname=?, Lastname=?, DOB=?,

    Gender=?, Address=?, Email=?, Mobile=?, Nationality=? where StudentNo=?";

    pstmt = con.prepareStatement(updt);

    pstmt.setString(1,jTextField2.getText());

    pstmt.setString(2,jTextField3.getText());

    pstmt.setString(3,jTextField4.getText());

    pstmt.setString(4, (String) jComboBox1.getSelectedItem());

    pstmt.setString(5,jTextField6.getText());

    pstmt.setString(6,jTextField7.getText());

    pstmt.setString(7,jTextField8.getText());

    pstmt.setString(8,jTextField9.getText());

    pstmt.setString(9,jTextField1.getText());

    pstmt.executeUpdate();

    JOptionPane.showMessageDialog(null,"Data has been Updated");

    jTextField1.setText("");

    jTextField2.setText("");

    jTextField3.setText("");

  • 7/29/2019 flihuhgurhug

    28/59

    28

    jTextField4.setText("");

    jComboBox1.setSelectedItem("");

    jTextField6.setText("");

    jTextField7.setText("");

    jTextField8.setText("");

    jTextField9.setText("");

    }

    } catch (SQLException ex) {

    Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);

    }

    }

  • 7/29/2019 flihuhgurhug

    29/59

    29

    4.9 Code for Delete Button

    Almost all the forms contain Delete button. Here is one example of Delete button code

    from the Student Form.

    private void jbtn_deleteActionPerformed(java.awt.event.ActionEvent evt) {

    // TODO add your handling code here:

    try {

    String dlt="delete from Student where StudentNo='"+jTextField1.getText()+"'";

    pstmt = con.prepareStatement(dlt);

    if(JOptionPane.showConfirmDialog(null,"Are You Sure You Want to

    Delete?","Confirm",JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION)

    {pstmt.executeUpdate();

    jTextField1.setText("");

    jTextField2.setText("");

    jTextField3.setText("");

    jTextField4.setText("");

    //jTextField5.setText("");

    jComboBox1.setSelectedItem("");

    jTextField6.setText("");

    jTextField7.setText("");

    jTextField8.setText("");

    jTextField9.setText("");

    }

    else

    {

    return;

    }

    }

    catch (SQLException ex) {

    Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);

    }

    }

  • 7/29/2019 flihuhgurhug

    30/59

    30

    4.10 Code for Close Button

    Almost all the forms contain Close button. Here is one example of Close button code from

    the Student Form.

    private void jbtn_closeActionPerformed(java.awt.event.ActionEvent evt) {// TODO add your handling code here:

    if(JOptionPane.showConfirmDialog(null,"Are You Sure You Want to

    Close?","Confirm",JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION)

    {

    MainForm mf = new MainForm();

    this.hide();

    mf.show();

    }

    }

  • 7/29/2019 flihuhgurhug

    31/59

    31

    5 Testing

    5.1 Format of Testing

    On successful completion of the application software it was tested by using Black Box

    Testing method. Names of Student, Programme, Lecturer, Course and Enroll studentwere inserted and the data was successfully saved in the database. On retrieving the data

    using the search button it was successfully displayed further few updates were done to

    already saved data. In order to reflect the successful working of the software data can be

    searched from the database and can be deleted if required. To use this system the user

    must first connect with the JDBC by giving Data Source Name as studentdsn.

    5.2 Login Form Testing

    If the user clicks on Login button without inserting username and password the system

    shows Please Enter Username & Password message.

    Actual Username & Password is admin and if the user enters wrong Username &

    Password like student then the system will show Invalid Username & Password

    message.

  • 7/29/2019 flihuhgurhug

    32/59

    32

    Finally if the user enters correct username and password i.e. admin then it will open

    Main form of the system.

    Successful login opens Main form of the system.

  • 7/29/2019 flihuhgurhug

    33/59

    33

    5.3 Main Form Testing

    After Successful login system opens Main form which is displayed below. This Main form

    contains several buttons which are linked to their respective forms. When the user clicks

    on any of these buttons it will open their respective form and when the user finishes its

    work on that particular form and click on the close button it will hide that form and display

    Main form which can be further used by the user to open other forms. Finally after

    finishing work on the system when the user clicks on Exit button on the Main form it will

    exit from the system and display login form again.

  • 7/29/2019 flihuhgurhug

    34/59

    34

    5.4 Student Form Testing

    When the user opens Student Form for the first time, system will allow user to Save, Clear

    or Search Student while the user wont be able to Update or Delete unless search is

    successful. Here is one example of testing which shows screenshot of database which

    already contains 2 student records in the student database.

    Now when the user inserts new student with record Student No (3), First Name (John),Last Name (Abraham), DOB (05/10/1988), Gender (Male), Address (Victoria), Email

    ([email protected]), Mobile (07856456789), Nationality (Spanish) and when the

    user clicks on Save button system shows the message Data has been Saved ! and then

    data stores in the Student database.

  • 7/29/2019 flihuhgurhug

    35/59

    35

  • 7/29/2019 flihuhgurhug

    36/59

    36

    Now there are 3 records in the Student database table. When the user searches for

    Student No 4 the system will show Please Enter Correct StudentNo to Search

    message.

    Since there are 3 Student records in the database, when the user searches for Student

    No (3) it will retrieve Student No (3) data from the database and display it on the Student

    Form.

  • 7/29/2019 flihuhgurhug

    37/59

    37

    After retrieving Student No 3 record, if the user changes address from Victoria to

    Stratford and click on Update button it will show message Data has been Updated !.

  • 7/29/2019 flihuhgurhug

    38/59

    38

  • 7/29/2019 flihuhgurhug

    39/59

    39

    Now since there are 3 records in the student database, if the user search for the Student

    No (2) and clicks on Search it will retrieve data from the student database and display it

    on the Student form and when the user click on Delete button the system will ask the

    user Are you sure you want to Delete and if the user click on yes it will delete Student No

    (2) record from the Student database.

  • 7/29/2019 flihuhgurhug

    40/59

    40

    5.5 Programme Form Testing

    When the user opens Programme Form for the first time, system will allow user to Save,

    Clear or Search Programme while the user wont be able to Update or Delete unless

    search is successful. Here is one example of testing which shows screenshot of database

    which already contains 2 Programme records in the Programme database.

    Now when the user inserts new Programme with the record Programme No (3), Title

    (B.Sc Computing), Level (1st Year) and when the user clicks on Save button system

    shows Data has been Saved ! message and then data stores in the Programme

    database.

  • 7/29/2019 flihuhgurhug

    41/59

    41

  • 7/29/2019 flihuhgurhug

    42/59

    42

    Now there are 3 records in the Programme database. When the user searches for

    Programme No 4 the system will show Please Enter Correct ProgrammeNo to search

    message.

    Since there are 3 Programme records in the Programme database, when the user

    searches for Programme No (3) it will retrieve Programme No (3) data from the

    Programme database and display it on the Programme Form.

  • 7/29/2019 flihuhgurhug

    43/59

    43

    After retrieving Programme No 3 record, if the user changes Level from 1st Year to 2nd

    Year and click on Update button it will show message Data has been Updated !.

  • 7/29/2019 flihuhgurhug

    44/59

    44

    Now since there are 3 records in the Programme database, if the user search for the

    Programme No (2) and clicks on Search it will retrieve data from the Programme database

    and display it on the screen and when the user click on Delete button the system will ask

    the user Are you sure you want to Delete and if the user click on yes it will delete

    Programme No (2) record from the Programme database.

  • 7/29/2019 flihuhgurhug

    45/59

    45

    5.6 Lecturer Form Testing

    When the user opens Lecturer Form for the first time, system will allow user to Save,

    Clear or Search Lecturer while the user wont be able to Update or Delete unless search

    is successful. Here is one example of testing which shows screenshot of database which

    already contains 2 Lecturer records in the Lecturer database.

    Now when the user inserts new Lecturer with the record Lecturer No (3), First Name

    (George), Last Name (Toland), Email ([email protected]), Mobile

    (07509127213) and when the user clicks on Save button system shows Data has been

    Saved ! message and then data stores in the Lecturer database.

  • 7/29/2019 flihuhgurhug

    46/59

    46

    Now there are 3 records in the Lecturer database. When the user searches for LecturerNo 4 the system will show Please Enter Correct LecturerNo to Search message.

  • 7/29/2019 flihuhgurhug

    47/59

    47

    Since there are 3 Lecturer records in the database, when the user searches for Lecturer

    No (3) it will retrieve Lecturer No (3) data from the Lecturer database and display it on the

    Lecturer Form.

  • 7/29/2019 flihuhgurhug

    48/59

    48

    After retrieving Lecturer No 3 record, if the user changes Email from

    [email protected] to [email protected] and click on Update

    button it will show message Data has been Updated !.

  • 7/29/2019 flihuhgurhug

    49/59

    49

    Now since there are 3 records in the Lecturer database, if the user search for the Lecturer

    No (2) and clicks on Search it will retrieve data from the Lecturer database and display it

    on the screen and when the user click on Delete button the system will ask the user Are

    you sure you want to Delete and if the user click on yes it will delete Lecturer No (2)

    record from the Lecturer database.

  • 7/29/2019 flihuhgurhug

    50/59

    50

    5.7 Course Form Testing

    When the user opens Course Form for the first time, system will allow user to Save, Clear

    or Search Lecturer while the user wont be able to Update or Delete unless search is

    successful. Here is one example of testing which shows screenshot of database which

    already contains 2 Course records in the Course database.

    Now when the user inserts new Course with the record like Course No (3), Course Name

    (Database Systems), Semester Duration (2), Programme No(3), Lecturer No (1) and when

    the user clicks on Save button system shows Data has been Saved ! message and then

    data stores in the Course database.

  • 7/29/2019 flihuhgurhug

    51/59

    51

  • 7/29/2019 flihuhgurhug

    52/59

    52

    Now there are 3 records in the Course database. When the user searches for Course No

    4 the system will show Please Enter Correct CourseNo to Search message.

    Since there are 3 Course records in the Course database, when the user searches for

    Course No (3) it will retrieve Course No (3) data from the Course database and display it

    on the Course Form.

  • 7/29/2019 flihuhgurhug

    53/59

    53

    After retrieving Course No 3 record, if the user changes Semester Duration from 2 to

    1 and click on Update button it will show message Data has been Updated !.

  • 7/29/2019 flihuhgurhug

    54/59

    54

    Now since there are 3 records in the Course database, if the user search for the Course

    No (2) and clicks on Search it will retrieve data from the Course database and display it on

    the Course form and when the user click on Delete button the system will ask the

    user Are you sure you want to Delete and if the user click on yes it will delete Course No

    (2) record from the Course database.

  • 7/29/2019 flihuhgurhug

    55/59

    55

    5.8 Enroll Form Testing

    When the user opens Enroll Form for the first time, system will allow user to Enroll

    Student. Here is one example of testing which shows screenshot of database which has

    blank Enroll database.

    Now when the user Enroll new student with the record Student No (1), Course No (3),

    Enrolment Date (12/03/2011), Semester Duration (2) and when the user clicks on Enroll

    button system shows Data has been saved message and then data stores in the Enroll

    database.

  • 7/29/2019 flihuhgurhug

    56/59

    56

  • 7/29/2019 flihuhgurhug

    57/59

    57

    6 Critical Appraisal

    6.1 Introduction

    Student Enrolment System has been designed to aid educational institutions in order to

    keep a track of its students, lecturers as well the programmes and courses offered. This

    system enables the institution to Enroll new students and add new programmes, courses

    or lectures working with them. The system assigns every individual with its unique

    identification code which enables the institution to follow its cause.

    The project itself has been designed, taking into consideration every aspect of real life

    situation which an educational institution faces. Secure Login, the facility to add or remove

    new individuals and update features of this system reflect the success of the project that

    has been worked on. As it has been demonstrated in this report how the system worksand allows the institutions to take utmost advantage of it. This is a real life project based

    on a real life situation and is ready to use by the users. The system is user-friendly and

    self guiding wherever the situation of help arises.

    6.2 Discussion of Analysis

    An analysis was carried out about the various Student Enrolment System which are used

    by the educational institution around the world today. The features offered by them which

    make the task of the user working on the system very easy. Before developing any

    system, the primary aim of the developer is the ease and comfort of the user. The

    Enrolment Systems around the world are designed keeping in the mind the most

    important thing, i.e. the comfort of the user and the safety and security of the institution

    itself. After analysing this, the design for my project was put forth.

    6.3 Discussion of Design

    The biggest advantage of my system is that when a user clicks on Save, Search, Update,

    Delete, and Close, the system pops up a message about the successful completion of the

    task. This provides the user with mental relief and satisfaction that his task has been

    carried out to the full. One of the advantages of this system can be noted as that user can

    Save, Search, Update and Delete data from the same form. The Update and Delete

    feature in each form will be active only after the successful search. This will prevent

    accidental loss of data.

  • 7/29/2019 flihuhgurhug

    58/59

    58

    6.4 Discussion of Implementation

    As discussed in the report, the design which was finalised after analysing a number of

    designs has been successfully implemented resulting in real life software. The

    implementation has been a success to a great deal. The real implementation has been

    demonstrated in the report by giving snapshots of the real coding which is written todevelop the system.

    6.5 Discussion of Testing

    The most important aspect of the system is the successful working of it. It is necessary for

    a developer to demonstrate that his system is working and can be used by any user

    around the globe. This can be done by randomly testing the system against any odd

    inputs. These inputs should come out with the expected results that may show the

    successful working of the system.

    This has been done in the report to show the working of the system. Random data has

    been used and outputs are generated. The screenshots of this output has been attached

    in this report which shows that the system can perform all the operations that were

    discussed in the design section.

    6.6 Areas of Improvement

    The system has been designed in a manner so that it can be improved or updated to get

    more benefits out of it. The features offered by the system at this stage are Saving,

    Searching, Updating and Deleting Student, Programme, Lecturer, Course and Enroll

    Student information. Further improvements can be done in a system by giving the

    attributes of saving financial information such as Fees Payment, Library loans and fines,

    examination registration and results.

    6.7 Lessons learnt during the project

    This project has provided me with an opportunity to implement the theoretical knowledge

    gained during the academic year, to develop a real life system at a practical level. The

    strength of the learner in an IT field does not lie in the theoretical knowledge that he

    possesses, instead what matters is, the implementation of that theoretical knowledge to

    come out with a successful system. This will enable him to show that he can transfer his

    skills from the books to this complex world of computers.

    During the development of this project, I have learnt number of lessons which allowed me

    to test my knowledge and the practical skills. The use of Java Netbeans and MicrosoftAccess 2003 using JDBC taught me a variety of new things associated with them.

  • 7/29/2019 flihuhgurhug

    59/59

    The most important thing that I learnt at the very initial stage in the development of the

    system was about JDBC. I was not aware how to connect JDBC with the application

    software. I was really confused how to go ahead with this and as it was a very crucial

    stage in the beginning of this software, I was really worried. At this moment I take an

    opportunity to thank my supervisor who helped me to come out of this situation by guiding

    me to the right path. From there on the development of the system has been a smooth

    progress throughout.

    The real success of this project lies in the fact that it taught me how to manage a real life

    project. The search of literature, the analysis of the design available for the development

    of the software, the implementation of the design and the successful outcome of the

    project are all very important stages of the project management. I learnt the importance of

    all this stages during the development of this system.

    To conclude, I want to thank my supervisor for the extensive support throughout the

    project and providing me with an opportunity to demonstrate my practical skills. With this

    project under my belt, I am now confident of developing even more complex systems in

    the following years of my education.