result computation and generation in a

0 downloads 0 Views 26MB Size Report
that corresponds to the letter grade made in a course [10]. This write up ...... Paul Deitel and Harvey Deitel, (2007), Java How To Program, Pearson. Educational ...
RESULT COMPUTATION AND GENERATION IN A COMPREHENSIVE STUDENT RECORD AND RESULT PROCESSING SYSTEM

BY

AKINYEMI JOSEPH DAMILOLA MATRICULATION NUMBER: 06/55EC050

A PROJECT WORK SUBMITTED TO THE DEPARTMENT OF COMPUTER SCIENCE, FACULTY OF COMMUNICATION AND INFORMATION SCIENCE, UNIVERSITY OF ILORIN, ILORIN, NIGERIA, IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE AWARD OF BACHELOR OF SCIENCE (B. Sc.) DEGREE, IN COMPUTER SCIENCE JULY, 2010.

CERTIFICATION This is to certify that this project work was carried out by AKINYEMI JOSEPH DAMILOLA, with matriculation number 06/55EC050 in the Department of Computer Science, Faculty of Communication and Information Science, University of Ilorin, Ilorin, Nigeria.

Mr. A.O. Bajeh

Date

(Supervisor)

Prof. J.S. Sadiku

Date

(Head of Department)

External Examiner

Date

ii

DEDICATION This project is dedicated to the almighty God, the sole creator of mankind and director of all his endeavours and to my parents whom, by their painstaking efforts and God’s grace, have brought me this far.

iii

ACKNOWLEDGEMENT I am most grateful to God who gave me the opportunity to carry out this final year project successfully and without regrets, and to graduate successfully from this citadel of knowledge. ‘Lord, You are my all in all’ I also appreciate the University of Ilorin administration and the Nigerian Universities Commission (NUC) that, in their wisdom, have included the Research Project in the school curriculum to be undertaken by all students in their final year. My acknowledgement is also directed to the Department of Computer Science, Faculty of Communication and Information Science of the University of Ilorin, Ilorin, Nigeria. I say “THANK YOU” to the Head of Department, Professor J.S. Sadiku and to all my lecturers – Dr. P.B. Shola, Dr. D.R. Aremu, Mr. R.O. Oladele, Mr. A.O. Babatunde, Mrs. R.O. Oladele, Mr. A.O. Ameen, Mr. L.B. Asaaju, Mr. R.G. Jimoh, Mrs. O.C. Abikoye, Mrs. Mabayoje, Mr. A.O. Bajeh and Engr. E. Olorunfemi – for all your impact and influence upon me. I am especially, grateful to my project supervisor, Mr. A.O. Bajeh for his words of advice, motivation and challenge. I will always be grateful to you for stretching out my potentials and making a meaning out of my undergraduate life. Thanks a lot, Sir. I express my sincere gratitude to all my classmates and friends in school. Moses (my Java tutor), Isaac (my analyst friend), Femi (my challenging friend), Tayo (a wonderful friend), Kibie (my most encouraging female classmate), Emeka (my very close friend), Yinka (my very good friend), Tosin, James and Chris (My microbiology friends), Onat, Prof., Kato Vincent and many others whose names, time and space constraint will not allow me mention. To all my friends, loved ones and ministers in the church – Aboo, Tope, Sir. Tee, Evelyn,

iv

Ronke, Pompey, Engineer Segee, Segun, Pst. Niyi, Pst. Adebisi, Pst. and Pst. (Mrs.) Obayemi, Pst. Adebisi, D-one, Nurse of God, Bro. Sola, Aburo, Curaco, all my ‘mums’ in the choir, all Glorious Unit/Youth and Singles Fellowship members, all who have been means of encouragement to me in one way or the other and to my great and loving friend Tope Bello, I am indebted to you. Finally, I sincerely appreciate my family and family friends. Plm and MBee, Dostine, Oluwummy, Tholarr, Oyinbo, T.K.M.U., Iya dudu, Bro. John and to my great and wonderful parents, Rev. (Dr.) and Rev. (Mrs.) D.B. Akinyemi, you will surely live to see me rise beyond your desire for me in Jesus name.

v

ABSTRACT This project work focuses generally on automating the processes involved in computing and generating students’ results. The process of computing and generating students’ results is very important to an academic department hence it should be properly taken care of. This process is currently performed manually, while some departments make use of Microsoft office Excel and these methods have proved inefficient in terms of the time and effort used in performing the operation. Hence, this project work focuses on a system developed to accomplish the processes of computing students’ results and generating the computed results in certain output formats. The system, called ‘CompSys’, performs this by maintaining a database that stores relevant details about each student and his registered courses, it then computes a students’ results from the raw scores obtained from the user. In summary, the Comprehensive Student Record and Result Processing System provides a better alternative for computing and generating students’ results as opposed to the existing methods.

vi

TABLE OF CONTENTS TITLE PAGE CERTIFICATION.....................................................................................................................II DEDICATION.......................................................................................................................... III ACKNOWLEDGEMENT....................................................................................................... IV ABSTRACT.............................................................................................................................. VI TABLE OF CONTENTS .......................................................................................................VII

CHAPTER ONE .........................................................................................................................1 INTRODUCTION.......................................................................................................................1 1.1

General Introduction ...................................................................................................1

1.1

Problem Statement.......................................................................................................1

1.3

Aim And Objectives .....................................................................................................2

1.4

Scope of The Study.......................................................................................................4

1.5

Justification...................................................................................................................5

1.6

Methodology .................................................................................................................5

1.7

Definition of Terms ......................................................................................................5

1.8

Synopsis of the Project.................................................................................................9

CHAPTER TWO ......................................................................................................................10 LITERATURE REVIEW ........................................................................................................10

vii

2.1

Background.................................................................................................................10

2.2

Works Reviewed.........................................................................................................12

2.3

Findings .......................................................................................................................12

2.4

Limitations ..................................................................................................................14

CHAPTER 3 ..............................................................................................................................17 SYSTEM ANALYSIS AND DESIGN.....................................................................................17 3.1

Preamble .....................................................................................................................17

3.2

System Analysis ..........................................................................................................17

3.3

System Design .............................................................................................................21

CHAPTER 4 ..............................................................................................................................30 SYSTEM IMPEMENTATION................................................................................................30 4.1

Preamble .....................................................................................................................30

4.2

System Specification...................................................................................................30

4.3

Hardware Specification .............................................................................................31

4.4

Programming Language Used ..................................................................................32

4.5

Evaluation ...................................................................................................................33

CHAPTER FIVE ......................................................................................................................40 SUMMARY, CONCLUSION AND RECOMMENDATION...............................................40

viii

5.1

Summary .....................................................................................................................40

5.2

Conclusion...................................................................................................................40

5.3

Recommendation........................................................................................................41

RFEERENCES..........................................................................................................................42 APPENDIX A: FLOWCHART ...............................................................................................44 APPENDIX B: INTERFACE DESIGN ..................................................................................53 APPENDIX C: SOURCE CODE ............................................................................................57

LIST OF TABLES AND FIGURES Table 2.1

Format Of Good Standing Result.......................................................................11

Fig. 3.1

Database Entity Relationship Diagram..............................................................27

Fig. 3.2

UML Class Diagram ............................................................................................29

ix

CHAPTER ONE INTRODUCTION

1.1

General Introduction The effectiveness and efficiency of the use of computers in the handling of

Processes have made it an essential tool in our society. Several activities including those undertaken in industries, institutions and even homes have been computerized to reduce drudgery and enhance ease and greater efficiency. With regards to this, this project deals with the computation and generation of students result in an academic department using a Comprehensive Student Record and Result Processing System. This project is centered on the development of a Comprehensive Student Record and Result Processing System which will be used for processing of major (if not all) result and report generation task in a university academic department. This is aimed at improving the efficiency and effectiveness of students’ result processing in terms of data security, accuracy, time management and human effort reduction, knowing that the manual method of performing these tasks does not guarantee a hundred percent perfection in these areas. The application is developed using the department of Computer Science, University Of Ilorin as a case study.

1.1

Problem Statement Having observed the existing methods (manual and Microsoft Office

Excel) of processing student results, it is majorly faced with the problem of being strenuous (consuming more of human power) and consequently leading to inaccuracy and inefficiency as human efficiency reduces with time. The major activities performed in processing students’ results are:

1



Creation and maintenance of a record for each student to contain information about his/her registered courses & results.



Entry of students’ raw scores and grades in each course.



Computation of students’ result (including GPA and CGPA) and determination of passed and outstanding or failed courses.



Determination of student’s good standing status



Generation of students’ transcript and good standing list. However, the existing methods of performing these activities do not take

care of these activities efficiently enough. In Computer Science department of the University of Ilorin, for instance, Microsoft Office Excel is used to perform this operation; having programmed the application to compute results when given some parameters, while most other departments perform these activities manually. In spite of this, the application still poses the problems of tediousness, slowness and inaccuracy when the data becomes large, and thereby leading to general inefficiency in the system performance. Hence, this system has been developed to proffer solutions to these problems by making the processes involved in the computation and generation of student’s result, more flexible and accurate with respect to each student’s record.

1.3

Aim and Objectives The aim of this project is to develop a Comprehensive Student Record and

Result Processing System that will be able to compute students’ results corresponding to each student’s record and courses for which this particular student is registered, and produce output based on the computed results in desired formats. This aim will be achieved with the following objectives:

2

1. Development of a database to store students’, courses, and results records. 2. Development of a detailed data entry graphical user interface for students’ results. 3. Creation of an efficient and accurate result Computation and generation system that will compute and store students’ results. 4. Creation of a comprehensive report generation system that will produce the computed results in a specified format. The formats for the result output are: 

Sessional Transcript: This shows the details of a students’ result per session, which serves the function of the spreadsheet used in the existing system.



Overall Transcript: This shows the details of a particular student’s result from the year of his/her admission to the year of his graduation.



Good Standing List: This displays the list of students who are said to be in ‘good standing’ based on specific requirements and can proceed to the next level of their academic programmes.



Final Year Presentation List: This displays the list of students who have met the required number of credits for graduation and are therefore eligible to graduate and displays against their names, their respective classes of degree. The classes of degree with their respective Cumulative Grade Point Average (CGPA) are as follows: -

First Class Honours (CGPA: 4.50 - 5.00)

3

-

Second Class (Upper Division) Honours (CGPA: 3.50 – 4.49)

-

Second Class (Lower Division) Honours (CGPA: 2.40 – 3.49)

-

Third Class Honours (CGPA: 1.50 – 2.39)

-

Pass (CGPA: 1.00 – 1.49)

-

Aegrotat (CGPA: 0.00 – 0.99)

5. Development of a computer program that will include the above features and be configurable to suit any academic department, using the department of Computer Science as a case study. 6. Performance of result checking processes, which ensures the following: I.

Meeting the required number of credits for graduation.

II.

Ensuring that all core and required courses are passed.

III.

Listing of outstanding courses against any student at any level.

IV.

Ability to upload students’ results in Microsoft Excel format to lessen the fatigue of manual entry.

1.4

Scope of the Study The project covers mainly the aspect of Result Computation and

Generation in a Comprehensive Student Record and Result Processing System. This involves computing student’s result based on the supplied course and student information and then generating output based on this computed result in the specified formats stated above. The system is able to calculate students’ result by determining the grade for each input raw score and using this to determine the current Grade Point

4

Average and Cumulative Grade Point Average, which are then stored appropriately in the database.

1.5

Justification As earlier observed that the existing systems (both manual and Microsoft

Excel) are inefficient in providing most of the desirable services of a result processing system, the proposed system solves these problems by allowing most of the activities performed manually to be performed by the computer. Hence, the Comprehensive Student Record and Result Processing System automates the processes involved in processing students’ results within reasonable amount of time and human effort while ensuring data security and accuracy as much as possible. The system serves as a very useful tool for a level adviser and greatly simplifies most of his/her tasks which concern students’ results processing.

1.6

Methodology The methods used for this work include the consultation of my supervisor,

who is a Level Adviser, to obtain relevant information on the user requirements for the proposed system, surfing the internet for relevant details from reliable websites and consultation of textbooks and e-books. The application implements a friendly Graphical User Interface (GUI) developed using Java programming language because of its security and platform independency compared to other languages that can perform the same task [1], [2] and MySQL Database Management System (DBMS) due to its speed, ease of use and reliability [7].

1.7 

Definition of Terms Academic Department: A department/unit in a University System which is concerned with keeping and processing the academic record of students.

5



Automate: To make a process occur automatically by using automation techniques.



Browser: An application that is used to view and access web pages e.g. Internet Explorer, Mozilla Firefox, Opera etc.



Cumulative Grade Point Average (CGPA): This is used to indicate the level of a student’s academic performance in a tertiary academic institution. It is obtained by dividing the sum of a student’s weighted Grade Point by the total sum of credit units offered by this student.



Course: A program of study or training, especially one that leads to a degree or certificate from an educational institution [11].



Database: A systematically arranged collection of computer data, structured so that it can be automatically retrieved or manipulated [11].



Database Entity Relationship Diagram: A diagram showing the various database entities (tables, records, fields) and their inter-relationships.



Database Management System (DBMS): a computer program devised to create, store, and manipulate databases [11].



Structured Query Language (SQL): A database sublanguage used in querying, updating, and managing relational databases [11].



Field: A field is an attribute or a column in a relational database table.



Final Year Presentation List: A list of the names and the respective classes of degree of a number of graduating students in an academic institution.



Flowchart: A diagrammatic representation of the sequence of procedures or steps involved in the development of a solution to a problem.

6



Good Standing: A student is said to be in good standing if he/she has a CGPA equal to or greater than a specified value. Usually, it is a CGPA of 1.50 or more for fresh students and 1.00 for returning students in the department of Computer Science, University of Ilorin.



Grade: A number, letter or symbol indicating a student’s level of accomplishment [10]. In this text, it refers to letters A, B, C, D, E and F. It is therefore also referred to as letter grade in this write up.



Grade Point (GP): A point assigned to a course credit, as in a university, that corresponds to the letter grade made in a course [10]. This write up refers to Grade Point as it is being used in the University of Ilorin i.e. a grade point 5 for grade A, 4 for B, 3 for C, 2 for D, 1 for E and 0 for F.



Grade Point Average (GPA): An indication of a student’s academic achievement at a college or university calculated as the total number of grade points received over a given period, divided by the total number of credits awarded [5].



Graphical User Interface (GUI): An interface on the computer that interacts with a user, using graphical representations such as menus icons, buttons etc and not by using commands.



Input: It means data entered into the system or the action of entering data into the system.



Internet: The Internet is a collection of networks that are connected together for exchange of information [12].



Java: Java is a high level Object oriented programming language.



Microsoft Office Excel: A spreadsheet application developed by

7

Microsoft Corporation and included in the Microsoft Office Software Package. 

MySQL: A relational database query language used for creating and accessing databases.



Output: Data/information produced by the computer for the use by the user or the action of producing information from the computer.



Outstanding Course: A course is outstanding if it is compulsory (core or required) for a student to pass, but has not yet been passed by the student.



Platform: Software environment in which an application or software Operates or runs e.g. Operating System, Runtime Environment.



Processing: The process of transforming an input data into a format (information) that is suitable for output.



Programming Language: A language of communication with the computer used to instruct the computer to perform a specific task or solve a specific problem e.g. Basic, Java, Pascal etc.



Query: A request sent to the database to obtain certain information from the database.



Record: A row or collection of fields in a relational database table.



Script: A small dialog box that runs on a browser.



Session: An academic year consisting of two semesters e.g. 2009/2010 session.



Transcript: A transcript is a document which contains the statement of a student’s performance in an academic institution over a period of time.



Unified Modeling Language (UML): This is a graphical notation for

8

drawing diagrams of software concepts. The UML Class Diagram is an example of the many types of UML Diagrams [3]. 

WGP: The sum of the product of grade point and the credit unit in which the grade is obtained.

1.8

Synopsis of the Project This project work discusses Result Computation and Generation in a

Comprehensive Student Record and Result Processing System in five chapters summarized below. Chapter one presents an Introduction to the work discussing its aim, objectives, scope, justification and methodology with which this work was carried out. Chapter two contains the Literature Review which reviews previous works which perform similar functions as the System here developed. Chapter three presents the System Analysis and Design using three diagrams/charts – Flowchart, Database Entity Relationship Diagram and UML Class Diagram. Chapter four discusses the System Implementation by discussing the Programming language and Database Management System used to implement the system. Chapter five is titled Summary, Conclusion and Recommendation, it concludes this write up and recommends it for use in an academic department of the University.

9

CHAPTER TWO LITERATURE REVIEW

2.1

Background In order to develop a system that will provide a more efficient means of

computing and generating students’ results, it is necessary to have an overview of the existing systems developed to perform the same or similar tasks. This overview will give good insight into the functions of existing systems, their areas of limitations and areas that have been improved upon in the proposed system. The manual method of computing results has been replaced by the computerized means in some places in order to achieve greater results within a reasonable amount of time. However, these computerized methods still prove defective in some areas and therefore call for improvement. For instance, the Computer Science department of the University of Ilorin, a level adviser uses a program called Microsoft Office Excel (also called Microsoft Excel) to compute students’ results and produce certain outputs based on the computed results. Usually, the level adviser performs the following activities using Microsoft Excel: 

Creation of a Microsoft Office Excel spreadsheet for each student showing the list of courses he registered for in both first and second semesters.



At the end of each semester, when results are ready, the scores of each student are entered against respective courses.



At the end of each session, the level adviser also computes each student’s Grade Point Average and Cumulative Grade Point Average and determines individual good standing status (the Microsoft Excel spreadsheet has been programmed to compute these parameters).

10



The Level Adviser also receives from the COMSIT (Computer Services and Information Technology) Unit, a list of all students registered for each course and a result entry list for entering students’ result.



The Level Adviser prepares good standing results in the format shown below:

S/NO

MATRIC

NAMES

NO

IN FULL

TCO

TCP

TCF

GPA

PREVIOUS

CURRENT

REMARKS

CGPA

CGPA

(a)

(Surname

Outstanding

First & in

Results (3)

Capitals)

(b) Suspension of

Studies

etc.

Table 2.1 It is evident from the activities listed above that a level adviser still has to perform some time-consuming activities, such as preparing good standing results manually since this list cannot be generated automatically. In this vein, the Comprehensive Student Record and Result Processing System, seeks to provide a more efficient and effective way of performing students’ result processing activities while making the process interesting and easy to carry out. The system primarily serves as a tool for level advisers to manage and process the results of their advised students more conveniently.

11

2.2

Works Reviewed In the course of this work, two different existing works developed to

provide similar solutions to these problems have been reviewed. The reviewed works are: 

Easy GPA Calculator – Grade Point Average Calculator [8]. This will be referred to as Easy GPA Calculator throughout this text for simplicity.



GPA Calculator - Grade Point Average Calculator with Cumulative GPA Calculator [9]. This will be referred to as GPA Calculator throughout the text for simplicity.

2.3

Findings This section of the review deals with the observations and findings

obtained from the review of the selected works. This section discusses the selected works under two main headings; 

Functionality and Operation, which gives details of the basic operation modes and functionality provided by the reviewed systems.



Limitations, which explains the areas of limitation of the reviewed systems and the improvement of the proposed system over these limitations.

2.3.1

Functionality and Operation The modes of operation of the reviewed systems are similar but different.

Hence, one of these works provides functionalities which serve as advantages over the other. In order to carry out a proper review, the functionalities of the

12

reviewed works have been divided into Input, Processing, Output and Platform of Operation.

2.3.1.1

Input On both of these systems, data is input into the application through forms

containing textboxes, combo boxes and command buttons. The Easy GPA Calculator maintains a single webpage consisting of two columns of textboxes which are used for entering a student’s grade and credit unit respectively in a particular course while the GPA Calculator is also contained on a single webpage but consists of three columns used for entering the course credit unit, the letter grade and the grade point respectively. The Easy GPA Calculator is a script which only allows input for a student’s grade in a particular course and the corresponding credit unit and does so only for a maximum of fifty (50) courses at a time, while the GPA Calculator, also a script, allows input for a student’s grade and credit unit in a particular course for a maximum of ten (10) courses at a time. The GPA Calculator allows the user to enter the credit unit and the corresponding letter grade and the system determines the weighted grade point (which it calls Quality Points) and consequently the GPA. It also allows the user to enter the total credit units offered up to the previous semester and the CGPA earned accordingly and uses these data to determine the current CGPA of the student.

2.3.1.2

Output The outputs of both applications are produced in slightly different

manners. The Easy GPA Calculator presents its output on a script (in the form of

13

a dialog box) displayed over the page designed for input, while the GPA Calculator provides appropriately labeled textboxes on the input page to display the outputs accordingly.

2.3.1.3

Processing Both applications are applet-like and therefore run on browser web pages.

Both applications perform all computations at run time and dispose the values thereafter, in essence, no database is implemented to store values and computed values are therefore no longer accessible after the system is exited.

2.3.1.4

Platform of Operation Both the Easy GPA Calculator and the GPA Calculator operate on the

same platform. They are both applet-like scripts which can run on any browser such as Microsoft Internet Explorer, Mozilla Firefox Opera etc and can be run without Internet connection. The functionalities and operations discussed above reveal that these applications certainly have limitations. The next section of this review discusses these limitations and how they have been complimented in the proposed system.

2.4

Limitations Each of the reviewed applications has certainly provided solutions to the

problems encountered as at the time they were developed. However, they are relatively inefficient (in terms of capability with respect to the proposed system).

14

Some of the limitations of the systems as well as the improvements of the proposed system over these limitations are discussed below: 

The Easy GPA Calculator allows input for grade and course credit only and does so for a maximum of fifty (50) courses. Consequently, student details cannot be known and grades cannot be entered for more than fifty (50) courses at a time. This limitation is resolved in the proposed system by allowing the courses that can be registered for a particular

level

advised to be predefined and subsequently adding to it at will while necessary details are kept about each student and his/her registered courses. 

The Easy GPA Calculator produces its output on scripts (dialog box) which makes it non-presentable on paper while the GPA Calculator produces its output in textboxes on the same page where the input data are entered and is consequently a bit more presentable than the Easy GPA Calculator, although not as presentable as it would be if the output were displayed on a separate page dedicated to the output. All these limitations have been improved upon in the proposed system by producing output on frames (full windows) on which the print option can then be selected, this is because users, sometimes, may want to view what the input stored in the database looks like and not necessarily print it.



None of these systems provides means of entering data from a file i.e. all input is obtained manually from keyboard, whereas, the proposed system allows input to be entered from an existing file in a Microsoft Office Excel Format.

15



Both the Easy GPA Calculator and the GPA Calculator can only be obtained from the Internet by downloading or saving these pages, the proposed system eliminates the need and cost of having an Internet connection since it is a desktop application.

16

CHAPTER 3

SYSTEM ANALYSIS AND DESIGN

3.1

Preamble This chapter discusses in details, the analysis and design of the

Comprehensive Student Record and Result Processing System. In essence, this chapter involves the study and analysis of the various components of the system as well as the details of their design. The System Analysis covers the preliminary study, the feasibility study and the detailed study of the system, while the system design represents the system structure (using a UML Class Diagram), the system operation (using a Flowchart), the various database entities involved in the system (using a Database Entity Diagram).

3.2

System Analysis System Analysis is the process of studying a system by collecting factual

data,

understanding the

processes

involved,

identifying problems

and

recommending feasible suggestions for improving the system functioning. In this section, both the existing and the proposed systems are analyzed and eventually compared to ensure that the need for the development of the proposed system is actually justified.

17

3.2.1 Evaluation of the Existing System The activities of computing and processing students’ result is quite tasking and can be boring if there is no efficient and friendly means of getting it done. The major activities involved, as performed by the existing systems, are: 

Creation and maintenance of a record for each student to contain information about his/her registered courses & results.



Entry of students’ raw scores and grades in each course.



Computation of students’ result (including GPA and CGPA) and determination of outstanding and failed courses.



Determination of student’s good standing status



Generation of students’ transcript and good standing list. However, the existing methods of performing these activities do not take

care of these activities efficiently enough. In Computer Science department, for instance, as opposed to other departments where the manual method is used, Microsoft Office Excel is used to perform this operation; having programmed the application to compute results when given some parameters, in spite of this, the application still poses the problem of tediousness when the data becomes large and is not flexible enough to allow the complete automation of certain activities such as preparation of final year presentation list. Considering the fact that most of these activities are performed manually by providing input into the system to operate upon, there is need to design an efficient means of making the process more interesting and less cumbersome – hence the need for the proposed system.

18

3.2.2 Analysis of the Proposed System Basically, the Comprehensive Student Record and Result Processing System performs (automates) the activities performed by an academic level adviser on student records while adding some additional features. The system does this as follows: 1. Firstly, a student record must be created, from which necessary details about a student can be obtained. A record is also created for each course. The reason why these two records (i.e. student and course records) must be created first is that, the system combines relevant details about a student (obtained from the student’s record) with relevant details about a course (obtained from the course’s record) (e.g. student’s matriculation number and course code) to register a student for a particular course. Thus, the system validates a course registration by ensuring that both the course being registered for and the student being registered for the course, already exist. -

In creating a student or course record, the user is simply requested to supply necessary details about that student or course record, respectively. The details required to create both student and course records are shown in Fig. 3.1 in the database tables, student_tbl and course_tbl.

-

The system then checks to ensure that every required detail is supplied, if so, the system stores the supplied data appropriately, otherwise, it reports an error and prompts the user, to supply these required details.

19

2. The course registration is done by associating the unique attributes of each course (i.e. course code) with the unique attribute of each student (i.e. matriculation number). By doing this, the system is able to keep track of the course(s) for which each student is registered. The course registration is what gives the student the right to own a result for which raw scores can be entered and processed for each registered course. 3. Following this, a student’s raw scores in each course are entered for result computation to take place. 4. From the computed results, outputs such as Good standing list, Transcript, Final Year Presentation List can be generated. These forms of output are obtained by sending appropriate queries to the database from the application and are so prepared for ease of usage and reference.

3.2.3 Improvement of the Proposed System over the Existing System 1.

The activities/functions stated under the System Analysis can only be carried out by a user for whom a user account has been created and consequently has user access rights. This implements a security measure (which is not provided by the existing system) on the system and ensures that most (if not all) actions taken are permitted by an authorized user. The absence of this feature in the existing system causes duplication of effort and data insecurity which are solved in the proposed system.

2.

The Comprehensive Student Record and Results Processing System provides a user-friendly Graphical User Interface (GUI) in the form

20

of frames, dialog boxes, tables, forms etc, for performing all its operations. 3.

The system stores its obtained data in its database, retrieves data from same and manipulates the data obtained to produce relevant outputs. This makes information retrieval more convenient and fast.

4.

The Comprehensive Student Record and Result Processing System also incorporates a functionality that allows it to be configurable to suit any particular academic department or faculty within the university unit. This feature has been included for extensibility, but the system was designed using the computer science department as a case study.

5.

The system also compliments the manual method of data entry (particularly, results entry) by providing a means of entering data from a Microsoft Excel File (since the results are usually prepared in this format). This serves as an easier and less fatiguing alternative for entering data into the system and also as an improvement over the manual method of result entry, which is prone to errors.

3.3

System Design This is a very crucial stage in the development of the system. It is

therefore discussed under two main headings; the Preliminary or General Design and the Structured or Detailed Design.

21

3.3.1 Preliminary Design The Comprehensive Student Record and Result Processing System contains a variety of exciting features which make the system a desirable one. Most of these features, which have been included at, virtually no cost, have improved the efficiency of the proposed system over that of the existing system. Below is a highlight of the Comprehensive Student Record and Result Processing System: 1. A splash screen which is the first interface displayed when the application is launched and is still loading. 2. A login page which allows only registered users (level advisers) to access the system by entering their username and password. A user is a disallowed from accessing the system if the entered details do not match those stored in the database and an appropriate error message is displayed. A user is only allowed to try logging in for a maximum of three times after which, if the entries are still incorrect, the application terminates. 3. A database support as well as a database which stores/keeps the input data and from which they can be retrieved after being input. 4. The Student Module provides features/functions for manipulating Student data. Some of these features/functions include: I. II.

Creation of a new student record Editing, deleting and viewing already created student records

5. The Course Module provides features/functions for manipulating course information and course registration details. Some of these features include: I. II.

Creation of a new course record Editing, deleting and viewing already created course records

22

6. The Result Module provides features/functions for computing result and producing it in specified formats. Some of these features include: I. II.

Computing a student’s result Generation of Good standing list, Sessional and Overall Transcripts and Final Year Presentation List.

7. The system also provides features for reading input from file (Microsoft Excel File) and writing output to file (screen and printer).

3.3.2 Structured Design The Comprehensive Student Record and Result Processing System is designed to accept input, store it in its database, process this input data and consequently produce output based on this processed input data. The system is designed to be user-friendly and therefore makes use of GUI components and prompts that makes the program easy to use and user-friendly. The structured design is discussed here under three headings namely: The Required System Output, Required System Input and Processing Methods.

3.3.2.1

The Required System Output The major outputs expected from this system include:

I.

Students’ Result either in the form of sessional and overall Transcript, Good standing result or Final Year Presentation list.

II.

Students’ Information

III.

Course Information

IV.

Registration Information

23

These outputs are to be retrieved from the database and produced on graphical interfaces which should also enable, where necessary, printing of these outputs on paper.

3.3.2.2

The Required System Input In order to produce the above mentioned outputs, certain input data must

have been already captured. In view of this, the system provides GUI forms and tables for data entry into the system; the entered data are then captured, validated and stored in the database if they are correct, otherwise they are rejected and appropriate error messages are displayed. Some of the required inputs include: I.

User (Level Adviser) Account details i.e. user name, passwords, password hint and set advised

II.

Student data (names, matriculation number, sex etc)

III.

Course data (course code, course title, credit unit etc)

IV.

Course Registration data (student matriculation number, course code, credit unit)

V.

Result data (raw score)

The details to be entered on each input well indicated on the Database Entity Relationship Diagram in Fig. 3.1

3.3.2.3

Processing Methods The main processing tasks undertaken by the system are the course

registration and the result computation. A students’ result can be computed only for a course for which this student has been appropriately registered.

24

The result computation is performed as follows: I.

The total credit unit offered in a particular session (tcosess) by the student concerned is obtained from the user interface by summing over the individual credit unit of each course registered by this student for this session.

II.

The total credit unit offered (tco) by this student is also obtained from the database by summing over the individual credit unit (credit) of each course registered by this student for all sessions for which he/she is registered.

III.

The letter grade (lettgrade) and their corresponding grade points (gp) are determined.

IV.

The weighted Grade Point (wgp) for each course is obtained from the user interface and consequently stored into the database table, result_tbl, against their respective course.

V.

The total weighted Grade Point for a session (totwgpsess) is obtained from the user interface by summing over the individual weighted grade points of each course.

VI.

The total weighted Grade Point (totwgp) is obtained from the database table, result_tbl, by summing over the individual weighted grade points of each course as stored in the database table.

VII.

Having stored the result in the database, the GPA and CGPA are calculated from the details stored in the database table, result_tbl and eventually stored in the database table, grade_point_tbl.

VIII.

The above steps are clearly represented mathematically as follows:

25

tcosess = ∑(credit) {for a particular session for which a student has been registered}. tco = ∑(credit) {for all sessions for which a student has been registered}.

gp = 5 if lettgrade = A gp = 4 if lettgrade = B gp = 3 if lettgrade = C gp = 2 if lettgrade = D gp = 1 if lettgrade = E gp = 0 if lettgrade = F

wgp = cr * gp

totwgpses = ∑(wgp) {for a particular session for which a student has been registered}. totwgp = ∑(wgp) {for all sessions for which a student has been registered}

GPA = totwgpses / tcosess CGPA = totwgp / tco The various database entities (tables and fields) implemented by the Comprehensive Student Record and Result Processing System are illustrated in the Database Entity Relationship Diagram shown below:

26

Fig. 3.1 Database Entity Relationship Diagram As is seen above, the database has been designed to hold the required data in separate tables which are eventually linked with unique fields which serve as primary or foreign keys. This concept is known as Normalization and is implemented to avoid data duplication and redundancy, and to ensure concurrency and equality in the updating of such fields. It also serves as a means

27

of security to check on the values entered for these fields and ensure that they are the same in all tables. The Normalization concept has been adopted in three phases as seen in [4]: 

The First Normal Form in which any set of fields being repeated have been moved into their own table. The main table on which the matric_no field is present is the student_tbl, but is introduced into other tables as a foreign key in order to link each of those tables (such as result_tbl and course_tbl) to the student_tbl.



The Second Normal Form in which any field which contains redundant data is moved into another table. This was practically applied in determining the total credit offered (tco) of a student by including it on the grade_point_tbl rather than on the result_tbl since each student has access to only one CGPA but many results for several courses.



The Third Normal Form in which fields in the table that are not dependent on the key field are also moved into a separate table. This is implemented by creating a separate table for the users of the system since the user’s login details do not depend directly on the students’ details.

The Comprehensive Student Record and Result Processing System has been developed with an object-oriented programming language. Hence, the UML Class Diagram below describes the unchanging logical structure of the system by representing the objects (classes) and methods implemented in the system:

28

Fig. 3.2

UML Class Diagram

The flow of execution control is indicated in the flowchart shown in Appendix A.

29

CHAPTER FOUR

SYSTEM IMPLEMENTATION

4.1

Preamble This chapter deals with the System Implementation in terms of System

Specification, Hardware Specification, Documentation, Evaluation or Testing and Documentation. The System Implementation discusses the implementation of the System Design which was specified in the third chapter of this write up. System Implementation is the process of creating a blue print of a system based on its design i.e. turning the theoretical design into an actual physical design. In this phase, the proposed system is run and its output compared with that of the existing system when run on the same set of input data. The essence of this is to verify whether the new system meets the specified user requirements and has advantages over the existing one, if these conditions are satisfied, the existing system is phased out and the new one is set up.

4.2

System Specification The System Specification (also called Software Specification) means the

software requirements for the system to be efficiently run. The Comprehensive Student Record and Result Processing System is a platform-independent stand-alone application. Some of the features of the system include:

30



A friendly Graphical User Interface



A database support



Password protection



Menus and submenus



Computational ability



Generation of printable reports

To be able to run the software on a computer, the following are the software packages required: 

Microsoft Windows, Mac OS, Linux Operating System



Java ™ 6 update 17 Runtime Environment



MySQL Server 5.1

The last two packages are included in the software’s installer.

4.3

Hardware Specification Hardware Specification refers to the physical computer components

required for the efficient running of the system or software. The Hardware Specification for the Comprehensive Student Record and Result Processing System is stated as follows: 

A desktop or laptop computer



An Intel Pentium 4 or higher processor



1024MB of Random Access Memory



15.4” VDU or LCD screen

31



4.4

A printer

Programming Language Used A programming language is a language in which instructions are written to

the computer for it to perform a specific task or solve a particular problem. The Comprehensive Student Record and Result Processing System is developed using java and MySQL. Java is an object-oriented high level language developed by Sun Microsystems in 1995. Java is a language which evolved from C++ which had evolved from C language [2]. Java has been selected for the development of this system for the features it presents, namely (as seen in [1]): 

It’s both interpreted and compiled, thereby making it portable and robust (i.e. platform independent).



Security.



Machine independence.



Object-oriented nature.



Dynamism.



High Performance.



A rich store of already defined class libraries called API (Application Programming Interface).



Dynamic and Beautiful Graphical User Interface. On the other hand, MySQL is an open source Relational Database

Management System used to develop the Database Management of the Comprehensive Student Record and Result Processing System. It has been chosen

32

to serve this purpose because of the features it provides, some of which are security, speed and ease of use [7].

4.5

Evaluation The essence of System Evaluation is to ascertain that the system operates

as expected and to consequently optimize its performance. The Comprehensive Student Record and Result Processing System performs, among other processes, the processes of computing and generating students’ results in desired formats. The system is able to perform these actions by sending appropriate queries to the database in order to generate these forms of output (i.e. Sessional and overall Transcripts, Good Standing result and Final Year Presentation List). Below is shown the SQL commands used to obtain these forms of output: Sessional Transcript: select * from result_tbl Overall Transcript: select result_tbl.course_code, result_tbl.credit_unit, course_tbl.course_status, course_tbl.semester, result_tbl.total, result_tbl.grade, result_tbl.weighted_gp from result_tbl, course_tbl, grade_point_tbl where result_tbl.matric_no = grade_point_tbl.matric_no and course_tbl.course_code = result_tbl.course_code and result_tbl.matric_no = '07/55ec001' order by course_tbl.semester

33

Good Standing List: select grade_point_tbl.matric_no, student_tbl.surname, student_tbl.first_name, student_tbl.middle_name, grade_point_tbl.tco, grade_point_tbl.tcp, grade_point_tbl.tcf, grade_point_tbl.curr_gpa, grade_point_tbl.prev_cgpa, grade_point_tbl.curr_cgpa from grade_point_tbl, student_tbl where student_tbl.matric_no = grade_point_tbl.matric_no and grade_point_tbl.curr_cgpa >= 1.0

select result_tbl.course_code, result_tbl.credit_unit from result_tbl, course_tbl where result_tbl.result_status = 'Failed or Outstanding' and course_tbl.course_status = 'CORE' and result_tbl.course_code = course_tbl.course_code and result_tbl.matric_no = '07/55ec001' Final Year Presentation List: select surname, first_name, middle_name, sex, grade_point_tbl.degree_class from student_tbl, grade_point_tbl where grade_point_tbl.matric_no = student_tbl.matric_no order by grade_point_tbl.curr_cgpa desc

34

4.5.1 System Testing The aim of testing is to find errors that the program contains, and debug them so as to increase once level of confidence in the correct operation and robustness of the system. In view of this, provision has been made to catch and handle all errors and exceptions detected or even anticipated. Some of these include: 1. Logical Errors: Logical errors such as entering a wrong value (although of the expected type) for a particular parameter, can cause the production of erroneous results in the system. Hence the system provides means for users to view, edit and/or delete their input data. 2. Exceptions: The system is much more prone to these than to errors. Exceptions are unusual, abnormal or unexpected conditions that occur during program execution. Some major ones encountered in the system are: I.

SQLException:

This

occurs

during

connection

or

communication with the database server. It is properly handled using a try – catch block in the code. In the catch block, a Dialog box is displayed to indicate that an error has occurred and prompts the user to take an appropriate action, so that the system continues running efficiently. II.

NumberFormatException: This occurs when a bad or wrong (unexpected) number format is found in the input stream; an example is, mistakenly entering ‘3o’ for ‘30’ where an integer is expected. This also, is appropriately

35

handled by displaying an appropriate message to inform the user of the error and prompting him/her to retry while the system continues running. III.

FileNotFoundException: This exception occurs when the user is trying to input or output to a file that the system cannot locate whether because it does not exist or a wrong location was specified for it. This often occurs when trying to upload a student’s picture from a file or uploading results from a file. This is handled by displaying an appropriate message to inform the user that the file was not found and prompting him/her to retry while the system continues running.

4.5.2 Documentation and Maintenance The system has been properly documented for the sake of easy maintenance and extensibility in order to meet future demands. One of the means of documentation is the series of comments used in the program code. Comments within the code have been specified with the symbols I. II.

// - used for single line comments. /**

*/ - the javadoc, a multiple-line comment, used for industry

standard documentation. III.

/*

*/ - Used for multiple-line comments.

This feature has been included to allow proper and easy documentation of the program and to avoid tricky programming styles.

36

4.5.3 User Training In order to start using the Comprehensive Student Record and Result Processing System, the application installer, called CompSys setup installer, has to be launched to install the software together with every software necessary for the efficient running of the system. By following the set up instructions, the software installation can be completed and the software is installed and included in the programs installed on the computer. Having installed the application on the computer, it can be run by locating and clicking its icon (using Microsoft Windows); this launches the application’s splash screen followed by the user login page and eventually, its main window. The main window displays buttons and menus for performing the several functions of the system which include creating a new student record, editing, viewing, deleting an existing student record, creating a new course record, editing, viewing, deleting an existing course record, registering a student for a particular course, computing students’ results and generating appropriate result report in a specified format (Final Year Presentation List, Transcripts, Good Standing List). To create a user account with password settings, on the menu bar, click on File >> Level Adviser Tasks >> New Account, the displayed form is to be filled and a user account is created with the supplied information once the “Register User” button is clicked.

37

4.5.3 Benefits of the Proposed System The Comprehensive Student Record and Result Processing System offers the following benefits: 1. It facilities the processing of student record and results. 2. It reduces the tediousness involved in entering results manually by providing a means for entering results in already prepared format. 3. It quickens the process of result generation in the form of Transcript, Final Year Presentation List or Good Standing List. 4. It saves the time and cost involved in processing students’ record. 5. The Comprehensive Student Record and Result Processing System allows a large amount of data to be stored or kept over a long period. 6. It protects data from unauthorized access and allows stored data to be backed up in case of system failure. 7. The system is able to check to ensure that a student satisfies the requirements for graduation before including his/her name in the Final Year Presentation List.

4.5.4 Limitation of the Proposed System The Comprehensive Student Record and Result Processing System, as the name implies, is designed to process students’ records and from the processed records, compute and output result. The system is able to perform these actions based on the input data; however, it is not able to detect logical errors in the input data and this may lead to wrong computation and processing. An instance of such errors occurs due to entering 5 instead of 3 for credit unit during the creation of a

38

course record, this will, of course, lead to an unexpected rise or fall in the students’ CGPA. Although, the system is robust enough to handle most of the possible logical errors, this is only possible where the required input is known before hand or is restricted to a set of values. Otherwise, the system does not report any error but continues to process logically erroneous data thereby producing accurate but unexpected results.

39

CHAPTER FIVE

SUMMARY, CONCLUSION AND RECOMMENDATION

5.1

Summary The use of computers in solving problems often provides more efficient

and faster solutions compared to those provided by manual methods. Using this knowledge, the Comprehensive Student Record and Result Processing System was developed to provide solutions to the problems of computing and generating students’ results. These problems include inaccurate computation of results and strenuous result computation and generation process. The System implements a friendly Graphical User Interface to interact with users, thereby making the software user friendly and easy to use. The system is accessible only to users who have been registered on the system and consequently verified to have access rights to the system. In general, the system is able to compute results for courses registered for a particular student and to produce the computed results in certain formats.

5.2

Conclusion In conclusion, the Comprehensive Student Record and Result Processing

System has greatly reduced the difficulties posed by the existing methods of computing and generating students’ results by providing a ‘one-touch’ application that helps an Academic Level Adviser compute, store and generate students’

40

results in specified formats with greater accuracy and efficiency using a reduced amount of time and effort. The ability of this system to perform these actions is a great relief for an academic level adviser in producing results that will be accurate and timely and will be in certain desired formats.

5.3

Recommendation The Comprehensive Student Record and Result Processing System is a

system which will greatly reduce the several problems encountered in students’ result computation and generation which have been mentioned earlier. The system can therefore be implemented in any academic department that desires more efficient means of computing accurate results. With the system, an academic level adviser can perform his duties of maintaining proper records for his students as well as lecturing them in class while having time to attend to some other (extra-curricular) activities. This is because the system performs for him/her, the same job he/she would have done in hours and with much stress in just few minutes with less labour, consequently, saving his/her time. In view of this, I recommend the system for the use of all academic departments in the University of Ilorin for efficient management of their students’ records and for accurate and reliable computation of their results with efficient means of generating the much needed Good standing list, Sessional and Overall Transcripts and Final Year Presentation List.

41

RFEERENCES [1]

Vikas Gupta, (2007), Comdex Computer Programming Course Kit, Dreamtech press, ISBN 81-7722-229-5

[2]

Paul Deitel and Harvey Deitel, (2007), Java How To Program, Pearson Educational Inc., ISBN 0-13-613247-2

[3]

Robert Cecil Martin, (2002), UML for Java Programmers, Prentice Hall, ISBN 0-13-203837-4

[4]

Carey N. Prague and Michael R. Irwin, (2001), Access 2002 Bible, Hungry Minds Inc., ISBN 0 – 7645 – 3596 – X

[5]

http://www.encyclopedia.com/doc/1099-gradepointaverage.html, (2009), Definition of GPA (The Oxford Pocket Dictionary of Current English)

[6]

http://www.java.sun.com, 2009, Java Official Tutor

[7]

MySQL Reference Manual, © 1997-2000 TcX AB, Detron HB and MySQL Finland AB

[8]

http://www.college-scholarships.com/online_colege_gpa_calculator.htm, Easy GPA Calculator – Grade Point Average Calculator, American Education Guidance Center, (2000 – 2010).

[9]

http://www.laurasmidiheaven.com/Tools/GPACalculator.shtml,

GPA

Calculator - Grade Point Average Calculator with Cumulative GPA Calculator, Laura's MIDI Heaven, (1996 – 2009). [10]

http://www.answers.com

42

[11]

Microsoft® Encarta® 2009. © 1993-2008 Microsoft Corporation.

[12]

Microsoft Digital Literacy Curriculum. ©2006 Microsoft Corporation.

43

APPENDIX A: FLOWCHART

44

45

46

47

48

49

50

51

52

APPENDIX B: INTERFACE DESIGN

53

54

55

56

APPENDIX C: SOURCE CODE package schoolproject; import java.awt.Dimension; import java.awt.Toolkit; import java.sql.Connection; import javax.swing.JOptionPane; /** @author damak */ public class MainFrame extends javax.swing.JFrame { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int index = 0; String reqCredit; private Connection connection; static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DATABASE_URL = "jdbc:mysql://localhost/project_db"; static final String USERNAME = "root"; static final String PASSWORD = "damakins"; boolean status = false; ResultClass result; /** Creates new form MainFrame */ public MainFrame(Connection con) { initComponents(); status = true; if(status) statusLabel.setText("Connected successfully"); else statusLabel.setText("Connection not successful");

57

} connection = con; } private void newStudentButtonMouseEntered(java.awt.event.MouseEvent evt) { newStudentButton.setBorderPainted(true); newStudentButton.setContentAreaFilled(true); } private void newStudentButtonMouseExited(java.awt.event.MouseEvent evt) { newStudentButton.setBorderPainted(false); newStudentButton.setContentAreaFilled(false); } private void editRecordButtonMouseEntered(java.awt.event.MouseEvent evt) { editRecordButton.setContentAreaFilled(true); } private void editRecordButtonMouseExited(java.awt.event.MouseEvent evt) { editRecordButton.setContentAreaFilled(false); } private void viewStudentButtonMouseEntered(java.awt.event.MouseEvent evt) { viewStudentButton.setContentAreaFilled(true); } private void viewStudentButtonMouseExited(java.awt.event.MouseEvent evt) { viewStudentButton.setContentAreaFilled(false); } private void deleteRecordButtonMouseEntered(java.awt.event.MouseEvent evt) {

58

deleteRecordButton.setContentAreaFilled(true); } private void deleteRecordButtonMouseExited(java.awt.event.MouseEvent evt) { deleteRecordButton.setContentAreaFilled(false); } private void newCourseButtonMouseEntered(java.awt.event.MouseEvent evt) { newCourseButton.setContentAreaFilled(true); } private void newCourseButtonMouseExited(java.awt.event.MouseEvent evt) { newCourseButton.setContentAreaFilled(false); } private void editCourseButtonMouseEntered(java.awt.event.MouseEvent evt) { editCourseButton.setContentAreaFilled(true); } private void editCourseButtonMouseExited(java.awt.event.MouseEvent evt) { editCourseButton.setContentAreaFilled(false); } private void viewCourseButtonMouseEntered(java.awt.event.MouseEvent evt) { viewCourseButton.setContentAreaFilled(true); } private void viewCourseButtonMouseExited(java.awt.event.MouseEvent evt) { viewCourseButton.setContentAreaFilled(false); } private void viewCourseButtonActionPerformed(java.awt.event.ActionEvent evt) {

59

CourseFrame frame = new CourseFrame(connection); int w = frame.getSize().width; int h = frame.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; frame.setVisible(true); frame.setLocation(x, y); } private void sessionalTranscriptButtonMouseEntered(java.awt.event.MouseEvent evt) { sessionalTranscriptButton.setContentAreaFilled(true); } private void sessionalTranscriptButtonMouseExited(java.awt.event.MouseEvent evt) { sessionalTranscriptButton.setContentAreaFilled(false); } private void presentationListButtonMouseEntered(java.awt.event.MouseEvent evt) { presentationListButton.setContentAreaFilled(true); } private void presentationListButtonMouseExited(java.awt.event.MouseEvent evt) { presentationListButton.setContentAreaFilled(false); } private void computeResultButtonMouseExited(java.awt.event.MouseEvent evt) { computeResultButton.setContentAreaFilled(false); }

60

private void computeResultButtonMouseEntered(java.awt.event.MouseEvent evt) { computeResultButton.setContentAreaFilled(true); } private void newStudentButtonActionPerformed(java.awt.event.ActionEvent evt) { StudentFrame studentFrame = new StudentFrame(connection); int w = studentFrame.getSize().width; int h = studentFrame.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; studentFrame.setLocation(x, y); studentFrame.setVisible(true);

}

private void computeResultButtonActionPerformed(java.awt.event.ActionEvent evt) { ComputeResultFrame myClass = new ComputeResultFrame(connection); myClass.setSize(dim); myClass.setVisible(true); } private void sessionalTranscriptButtonActionPerformed(java.awt.event.ActionEvent evt) { sesTransFrame sFrame = new sesTransFrame(connection); int w = sFrame.getSize().width; int h = sFrame.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; sFrame.setLocation(x, y); sFrame.setVisible(true);

61

} private void presentationListButtonActionPerformed(java.awt.event.ActionEvent evt) { FinalYearFrame fFrame = new FinalYearFrame(connection); int w = fFrame.getSize().width; int h = fFrame.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; fFrame.setLocation(x, y); fFrame.setVisible(true); } private void newCourseButtonActionPerformed(java.awt.event.ActionEvent evt) { NewCourseDialog newDialog = NewCourseDialog(this,true,connection); int w = newDialog.getSize().width; int h = newDialog.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; newDialog.setLocation(x, y); newDialog.setVisible(true); } private void editCourseButtonActionPerformed(java.awt.event.ActionEvent evt) { CourseFrame frame = new CourseFrame(connection); int w = frame.getSize().width; int h = frame.getSize().height; int x = (dim.width-w)/2;

62

int y = (dim.height-h)/2; frame.setLocation(x, y); frame.setVisible(true); } private void editRecordButtonActionPerformed(java.awt.event.ActionEvent evt) { EditStudentFrame frame = new EditStudentFrame(connection ); int w = frame.getSize().width; int h = frame.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; frame.setLocation(x, y); frame.setVisible(true); } private void viewStudentButtonActionPerformed(java.awt.event.ActionEvent evt) { EditStudentFrame frame = new EditStudentFrame(connection); frame.enableModel(true); int w = frame.getSize().width; int h = frame.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; frame.setLocation(x, y); frame.setVisible(true); } private void deleteRecordButtonActionPerformed(java.awt.event.ActionEvent evt) { DeleteStudentFrame frame = new DeleteStudentFrame(connection);

63

frame.enableModel(true); int w = frame.getSize().width; int h = frame.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; frame.setLocation(x, y); frame.setVisible(true); } private void regCourseButtonMouseEntered(java.awt.event.MouseEvent evt) { regCourseButton.setContentAreaFilled(true); } private void regCourseButtonMouseExited(java.awt.event.MouseEvent evt) { regCourseButton.setContentAreaFilled(false); } private void regCourseButtonActionPerformed(java.awt.event.ActionEvent evt) { RegistrationFrame frame = new RegistrationFrame(connection); int w = frame.getSize().width; int h = frame.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; frame.setLocation(x, y); frame.setVisible(true); } private void addOrDropMouseEntered(java.awt.event.MouseEvent evt) { addOrDrop.setContentAreaFilled(true); }

64

private void addOrDropMouseExited(java.awt.event.MouseEvent evt) { addOrDrop.setContentAreaFilled(false); } private void addOrDropActionPerformed(java.awt.event.ActionEvent evt) { AddDropForm form = new AddDropForm(connection); int w = form.getSize().width; int h = form.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; form.setLocation(x, y); form.setVisible(true); } private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) { UserRegistrationDialog form = new UserRegistrationDialog(this, true, connection); int w = form.getSize().width; int h = form.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; form.setLocation(x, y); form.setVisible(true); } private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) { UserRegistrationDialog form = new UserRegistrationDialog(this,true,connection,1); int w = form.getSize().width; int h = form.getSize().height;

65

int x = (dim.width-w)/2; int y = (dim.height-h)/2; form.setLocation(x, y); form.setVisible(true); } private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) { DeleteUserDialog delete = new DeleteUserDialog(this, true, connection); int w = delete.getSize().width; int h = delete.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; delete.setLocation(x, y); delete.setVisible(true); } private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) { int exit = JOptionPane.showConfirmDialog(null, "Are you sure you want to exit this application", "Exit", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if(exit == JOptionPane.YES_OPTION) { System.exit(0); } } private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) { this.dispose(); UserLoginFrame userFrame = new UserLoginFrame();

66

int h = userFrame.getSize().height; int w = userFrame.getSize().width; int x = (dim.width - w) / 2; int y = (dim.height - h) / 2;

userFrame.setLocation(x, y); userFrame.setVisible(true); } private void overallTranscriptButtonActionPerformed(java.awt.event.ActionEvent evt) { OverallFrame overall = new OverallFrame(connection); int h = overall.getSize().height; int w = overall.getSize().width; int x = (dim.width - w) / 2; int y = (dim.height - h) / 2; overall.setLocation(x, y); overall.setVisible(true); } private void overallTranscriptButtonMouseExited(java.awt.event.MouseEvent evt) { overallTranscriptButton.setContentAreaFilled(false); } private void overallTranscriptButtonMouseEntered(java.awt.event.MouseEvent evt) { overallTranscriptButton.setContentAreaFilled(true); } private void goodstandingResultButtonActionPerformed(java.awt.event.ActionEvent evt) {

67

result = new ResultClass(connection); } private void goodstandingResultButtonMouseExited(java.awt.event.MouseEvent evt) { goodstandingResultButton.setContentAreaFilled(false); } private void goodstandingResultButtonMouseEntered(java.awt.event.MouseEvent evt) { goodstandingResultButton.setContentAreaFilled(true); } /** @param args the command line arguments

*/

public static void main(String args[]) { } // Variables declaration private javax.swing.JMenuItem aboutMenuItem; private javax.swing.JButton addOrDrop; private javax.swing.JMenuItem applicationHelpMenuItem; private javax.swing.JButton computeResultButton; private javax.swing.JMenuItem configureMenuItem; private javax.swing.JButton deleteRecordButton; private javax.swing.JButton editCourseButton; private javax.swing.JButton editRecordButton; private javax.swing.JMenuItem exitMenuItem; private javax.swing.JMenu fileMenu; private javax.swing.JButton goodstandingResultButton; private javax.swing.JMenu helpMenu; private javax.swing.JLabel jLabel1;

68

private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JMenu jMenu1; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem2; private javax.swing.JMenuItem jMenuItem3; private javax.swing.JMenuItem jMenuItem4; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JButton newCourseButton; private javax.swing.JButton newStudentButton; private javax.swing.JButton overallTranscriptButton; private javax.swing.JButton presentationListButton; private javax.swing.JButton regCourseButton; private javax.swing.JButton sessionalTranscriptButton; private javax.swing.JLabel statusLabel; private javax.swing.JPanel tab1Panel; private javax.swing.JButton viewCourseButton; private javax.swing.JButton viewStudentButton; // End of variables declaration }

69

package schoolproject; import java.awt.Color; import java.awt.Dimension; import java.awt.Toolkit; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; import javax.swing.DefaultComboBoxModel; import javax.swing.UIManager;

/** * * @author damak */ public class UserLoginFrame extends javax.swing.JFrame { private Connection con; private int logAttempt = 0, trial; static final String DRIVER = "com.mysql.jdbc.Driver"; static final String URL = "jdbc:mysql://localhost/project_db"; static final String USER_NAME = "root"; static final String PASSWORD =

"damakins";

DefaultComboBoxModel model; PreparedStatement userPStmt; Statement userStmt; ResultSet rSet;

70

LevelAdviser levAdv; MainFrame mainFrame; Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); /** Creates new form UserLoginFrame */ public UserLoginFrame() { model = new DefaultComboBoxModel(); try { Class.forName(DRIVER); con = DriverManager.getConnection(URL, USER_NAME, PASSWORD); } catch(Exception e) { JOptionPane.showMessageDialog(null, "Error connecting to database", "Error", JOptionPane.ERROR_MESSAGE); } initComponents(); getUserName(); levAdv = new LevelAdviser(con); mainFrame = new MainFrame(con); } public void getUserName() { uNameComboBox.setSelectedIndex(-1); uNameComboBox.addItem("Select User"); try { userPStmt = con.prepareStatement("select user_name from level_adviser_tbl"); rSet = userPStmt.executeQuery(); while(rSet.next()) {

71

uNameComboBox.addItem(rSet.getString("user_name")); } } catch(SQLException e) { JOptionPane.showMessageDialog(null, "Unable to connect to Database", "Database Error", JOptionPane.ERROR_MESSAGE); } } private void passwordFieldActionPerformed(java.awt.event.ActionEvent evt) { loginButtonActionPerformed(evt); } private void hintLabelMouseEntered(java.awt.event.MouseEvent evt) { hintLabel.setForeground(Color.blue); String hint = levAdv.getHint((String)uNameComboBox.getSelectedItem());

hintLabel.setToolTipText("Hint: "+hint); } private void hintLabelMouseExited(java.awt.event.MouseEvent evt) { hintLabel.setForeground(Color.black); } private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) { String pwd = String.copyValueOf(passwordField.getPassword()); String name = (String)uNameComboBox.getSelectedItem(); boolean userVerified = levAdv.verifyUser((String)uNameComboBox.getSelectedItem(), pwd); if(userVerified) {

72

try { mainFrame.setSize(dim); mainFrame.setVisible(true); this.dispose(); } catch(Exception e) { e.printStackTrace(); } } else { ++logAttempt;

trial = 3 - logAttempt;

if(!(logAttempt == 3)) { JOptionPane.showMessageDialog(null, "Invalid User Name or Password. You have " +trial+ " trial(s) left."+ "\nPoint to Password Hint for your password hint" + " so you can remember your password", "Invalid Entries", JOptionPane.ERROR_MESSAGE); passwordField.setText(""); } else { JOptionPane.showMessageDialog(null, "Invalid Password! You cannot make more than three attempts", "Invalid Entry", JOptionPane.ERROR_MESSAGE); System.exit(0); } } }

73

private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) { int exit = JOptionPane.showConfirmDialog(null, "Are you sure you want to exit this application", "Exit", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if(exit == JOptionPane.YES_OPTION){ System.exit(0); } } /** @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { try{

UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFee l"); UserLoginFrame userFrame = new UserLoginFrame(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int h = userFrame.getSize().height; int w = userFrame.getSize().width; int x = (dim.width - w) / 2; int y = (dim.height - h) / 2; userFrame.setLocation(x, y); userFrame.setVisible(true); } catch(Exception e){ e.printStackTrace();

74

} } }); } // Variables declaration - do not modify private javax.swing.JButton cancelButton; private javax.swing.JLabel hintLabel; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JButton loginButton; private javax.swing.JPasswordField passwordField; private javax.swing.JComboBox uNameComboBox; // End of variables declaration }

package schoolproject; import java.sql.Statement; import java.sql.PreparedStatement; import java.sql.Connection; import java.sql.DataTruncation; import java.sql.ResultSet; import java.sql.SQLException;

75

import javax.swing.JOptionPane; /** * * @author damak */ public class LevelAdviser{ Connection con; Statement stmt; PreparedStatement pStmt; ResultSet rSet; public LevelAdviser(Connection connect){ try{ con = connect; pStmt = con.prepareStatement("insert into level_adviser_tbl values (?, ?, ?, ?, ?)"); stmt = con.createStatement(); } catch(SQLException e){ JOptionPane.showMessageDialog(null, "A connection with the Database could not be established", "No Connection", JOptionPane.ERROR_MESSAGE); } } public boolean createUser(String name, String pwd, String set, String hint){ boolean created = false; try{ if(!( (name.equals("")) || (pwd.equals("")) || (set.equals("")) ) ) { pStmt = con.prepareStatement("insert into level_adviser_tbl values (?, md5(?), ?, ?)"); pStmt.setString(1, name);

76

pStmt.setString(2, pwd); pStmt.setString(3, set); pStmt.setString(4, hint); pStmt.executeUpdate(); created = true; } else JOptionPane.showMessageDialog(null, "Please fill all required fields (i.e fields marked *)", "Required Fields Are Empty", JOptionPane.INFORMATION_MESSAGE); } catch(DataTruncation e){ JOptionPane.showMessageDialog(null, "User name cannot be longer than 30 characters!", "Error", JOptionPane.ERROR_MESSAGE); } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.toString(), "Error", JOptionPane.ERROR_MESSAGE); } return created; } public void deleteUser(String name){ try { pStmt = con.prepareStatement("delete from level_adviser_tbl where user_name = ?"); pStmt.setString(1, name); pStmt.executeUpdate(); }

77

catch(SQLException e){ JOptionPane.showMessageDialog(null, e.toString(), "Error", JOptionPane.ERROR_MESSAGE); } } public boolean verifyUser(String name, String pwd){ boolean verified = false; try{ rSet = stmt.executeQuery("select user_name from level_adviser_tbl where password = md5('" +pwd+ "')" + " and user_name = '" +name+ "'");

while(rSet.next()){ verified

= true;

} } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.toString(), "Error1", JOptionPane.ERROR_MESSAGE); } return verified; } public boolean changePassword(String name, String oldPwd, String newPwd, String hint){ boolean changed = false, canEdit = verifyUser(name, oldPwd); if(canEdit){ try{ pStmt = con.prepareStatement("update level_adviser_tbl set password = md5(?), " +

78

"password_hint = ? where user_name = ?"); pStmt.setString(1, newPwd); pStmt.setString(2, hint); pStmt.setString(3, name); pStmt.executeUpdate(); changed = true; } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.toString(), "Error2", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } } else JOptionPane.showMessageDialog(null, "Current password is Invalid", "Error", JOptionPane.ERROR_MESSAGE); return changed; } public String getHint(String userName){ String pwdHint = "Sorry, No Password Hint is available!"; try { rSet = stmt.executeQuery("select password_hint from level_adviser_tbl " + "where user_name = '" +userName+ "'"); while(rSet.next()){ if(!(rSet.getString("password_hint")).equals("")) pwdHint = rSet.getString("password_hint"); }

79

} catch(SQLException e){ JOptionPane.showMessageDialog(null, e.toString(), "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } return pwdHint; } public String getSetAdvised(String name){ String set = new String(); try { rSet = stmt.executeQuery("select set_advised from level_adviser_tbl " + "where user_name = '" +name+ "'"); while(rSet.next()){ set = rSet.getString("set_advised"); } } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.toString(), "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } return set; } }

package schoolproject;

80

import java.sql.Connection; import java.sql.Statement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Vector; import javax.swing.JOptionPane; /** * * @author damak */ public class ResultClass { PreparedStatement prepStmt, prepStmt1; //gpPrepStmt; Statement stmt; Connection con; ResultSet resultSet, rSet, rSet1; String matNo, courseCode, resultStatus, grade, session, remark, goodStandStat; int wgp, tco = 0, tcp = 0, tcf = 0, result, crUnit, sumCrUnit = 0, sumWgp = 0, totWgp = 0; float ca, exam, totalScore, prevGpaOld, prevGpaNew, gpa, prevCgpaOld, prevCgpaNew, cgpa; public ResultClass(Connection connection){ con = connection; try{ prepStmt = con.prepareStatement("insert into result_tbl values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ); stmt = con.createStatement(); } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.getMessage(), "Error Message", JOptionPane.ERROR_MESSAGE);

81

} } public void checkGoodStanding(String sess){ try{ resultSet = stmt.executeQuery("select prev_cgpa, curr_cgpa from grade_point_tbl"); if(resultSet.getFloat("curr_cgpa")>=1.5){ goodStandStat = "IN GOOD STANDING"; } else{ goodStandStat = "NOT IN GOOD STANDING"; } //generateGoodStandStat(goodStandStat)/**a printable JTable*/; } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } public Boolean ValidateEntry(String matNo, String sess){ try{ stmt = con.createStatement(); resultSet = stmt.executeQuery("select session from registered_courses_tbl where matric_no = '" + matNo + "'"); while(resultSet.next()){ if (resultSet.getString("session").equals(sess)){ return true;

82

} } } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } return false; } public int getWGP(int credit, Float score){ int gradePoint; int wgp = 0; try{ if(score>=70) gradePoint = 5; else if(score>=60) gradePoint = 4; else if(score>=50) gradePoint = 3; else if(score>=45) gradePoint = 2; else if(score>=40) gradePoint = 1;

83

else gradePoint = 0;

wgp = gradePoint * credit; } catch(ArithmeticException e){ } return wgp; } public String getDegreeClass(String matNo, float cgpa){ String degreeClass = new String(); try{ if(cgpa>=4.50) degreeClass = "FIRST CLASS HONOURS"; else if(cgpa>=3.50) degreeClass = "SECOND CLASS (UPPER DIVISION) HONOURS"; else if(cgpa>=2.40) degreeClass = "SECOND CLASS (LOWER DIVISION) HONOURS"; else if(cgpa>=1.50) degreeClass = "THIRD CLASS HONOURS"; else if(cgpa>=1.00) degreeClass = "PASS";

84

else degreeClass = "AEGROTAT"; } catch(Exception e){ e.printStackTrace(); } return degreeClass; } public float getPrevGPA(String mat){ try{ resultSet = stmt.executeQuery("select grade_point_tbl.curr_gpa from grade_point_tbl where matric_no = '" +mat+ "'"); while(resultSet.next()) prevGpaNew = resultSet.getFloat("curr_gpa"); } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } return prevGpaNew; } public float getCGPAWGP(String mat, String update){ int totWgp = 0; try{ resultSet = stmt.executeQuery("select weighted_gp " +

85

"from result_tbl where result_tbl.matric_no = '" +mat+ "'"); while(resultSet.next()){ totWgp = totWgp + resultSet.getInt("weighted_gp"); } resultSet = stmt.executeQuery("select grade_point_tbl.curr_cgpa from grade_point_tbl where matric_no = '" +mat+ "'"); while(resultSet.next()) prevCgpaNew = resultSet.getFloat("curr_cgpa"); } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } if(update.equals("previous")) return prevCgpaNew; return totWgp; } public int getTCO(String mat){ int tco = 0; try{ resultSet = stmt.executeQuery("select registered_courses_tbl.credit_unit " + "from registered_courses_tbl where registered_courses_tbl.matric_no = '" +mat+ "'"); while(resultSet.next()){ tco = tco + resultSet.getInt("credit_unit");

86

} } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } return tco; } public void updateResult(String mat, String code, int credit, float ca, float exam, float total,String rStatus, String grade, int wgp, String sess){ try{ resultSet = stmt.executeQuery("select course_code from result_tbl where matric_no = '" +mat+ "'" + "and session = '" +sess+ "'"); while(resultSet.next()){ if(resultSet.getString("course_code").equals(code)){ prepStmt = con.prepareStatement("update result_tbl set matric_no = ?, course_code = ?, credit_unit = ?, ca = ?, exam = ?, " + "total = ?, result_status = ?, grade = ?, weighted_gp = ?, session = ? " + "where matric_no = '" +mat+"' and course_code = '" +code+ "' and session = '" +sess+ "'"); prepStmt.setString(1, mat); prepStmt.setString(2, code); prepStmt.setInt(3, credit); prepStmt.setFloat(4, ca); prepStmt.setFloat(5, exam);

87

prepStmt.setFloat(6, total); prepStmt.setString(7, rStatus); prepStmt.setString(8, grade); prepStmt.setInt(9, wgp); prepStmt.setString(10, sess); prepStmt.executeUpdate(); return; } } prepStmt = con.prepareStatement("insert into result_tbl values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ); prepStmt.setString(1, mat); prepStmt.setString(2, code); prepStmt.setInt(3, credit); prepStmt.setFloat(4, ca); prepStmt.setFloat(5, exam); prepStmt.setFloat(6, total); prepStmt.setString(7, rStatus); prepStmt.setString(8, grade); prepStmt.setInt(9, wgp); prepStmt.setString(10, sess); prepStmt.executeUpdate(); } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.toString(), "Error", JOptionPane.ERROR_MESSAGE); }

88

} private int compTotalCredit(String matric, String whichTotal){ int tco = 0, tcp = 0, tcf = 0; try{ resultSet = stmt.executeQuery("select credit_unit from registered_courses_tbl " + "where matric_no = '" +matric+ "'"); while(resultSet.next()){ tco += resultSet.getInt("credit_unit"); } rSet = stmt.executeQuery("select credit_unit from result_tbl " +"where result_status = 'Passed' and matric_no = '" +matric+ "'"); while(rSet.next()){ tcp += rSet.getInt("credit_unit"); } rSet1 = stmt.executeQuery("select credit_unit from result_tbl " +"where result_status = 'Failed or Outstanding' and matric_no = '" +matric+ "'"); while(rSet1.next()){ tcf += rSet1.getInt("credit_unit"); } } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.toString(), "Error", JOptionPane.ERROR_MESSAGE); } if(whichTotal.equals("TCO")) return tco; else

89

if(whichTotal.equals("TCP")) return tcp; return tcf; } public void gpUpdate(String mat, float prevGpa, float currGpa, float prevCgpa, float currCgpa){ int totCo = compTotalCredit(mat, "TCO"); int totCp = compTotalCredit(mat, "TCP"); int totCf = compTotalCredit(mat, "TCF"); String degree = getDegreeClass(mat, currCgpa); try{ resultSet = stmt.executeQuery("select matric_no from grade_point_tbl where matric_no = '" +mat+ "'"); while(resultSet.next()){ if(resultSet.getString("matric_no").equals(mat)){ prepStmt = con.prepareStatement("update grade_point_tbl set prev_gpa = ?, curr_gpa = ?, " + "prev_cgpa = ?, curr_cgpa = ?, tco = ?, tcp = ?, tcf = ?, degree_class = ? " + "where grade_point_tbl.matric_no = ?" ); prepStmt.setFloat(1, prevGpa); prepStmt.setFloat(2, currGpa); prepStmt.setFloat(3, prevCgpa); prepStmt.setFloat(4, currCgpa); prepStmt.setInt(5, totCo); prepStmt.setInt(6, totCp); prepStmt.setInt(7, totCf); prepStmt.setString(8, degree);

90

prepStmt.setString(9, mat); prepStmt.executeUpdate(); return; } } prepStmt = con.prepareStatement("insert into grade_point_tbl values (?, ?, ?, ?, ?, ?, ?, ?, ?)"); prepStmt.setString(1, mat); prepStmt.setFloat(2, 0); prepStmt.setFloat(3, currGpa); prepStmt.setFloat(4, 0); prepStmt.setFloat(5, currCgpa); prepStmt.setInt(6, totCo); prepStmt.setInt(7, totCp); prepStmt.setInt(8, totCf); prepStmt.setString(9, degree); prepStmt.executeUpdate(); } catch(SQLException e){ JOptionPane.showMessageDialog(null, e.toString(), "Error", JOptionPane.ERROR_MESSAGE); } } }

91

Suggest Documents