Sunteți pe pagina 1din 97

Submitted by:KRISHNENDU.R.S Under Guidance of: Mr.

Nikhil Rasthogi, Miss Priyanka Pruthi Aptech Computer Education,

Pitamp ura Centere, New Delhi.

TABLE OF CONTENTS
Preface Acknowledgment Introduction Objective of e-project Pre-Production System Analysis Feasibility study Economic Analysis Technical Analysis Basic of Data Dictionary System Requirements Hardware & Software Production Waterfall Model Database Diagram Flow Chart DFD E-R Diagram Forms & Coding Post-Production Testing Self Experience

Page no:
4 5 6 7 8 9 13 13 14 16 19 20 20 21 22 24 26 27 185 185 199

PREFACE
As the part of the curriculum of the Aptech, we have to gain some practical knowledge to get an opportunity to learn the practical aspect of the organization real life. Our aim is to provide churning mechanism to bring various ideas present in the project selected. During the project schedule, we had tried to be in depth study of the problem of the existing system. We learned a lot about the subject. Attempts have been made to include all the aspects that have any direct or indirect link with the candidate system.

ACKNOWLEDGEMEN T
I would like to express my sincere gratitude to Mr. Nikhil Rastogi, Centre Owner, of Aptech Pitampura Centre, Delhi region for his constant guidance and immense support in the successful completion of this significant project and motivated our team to achieve highest standards of professionalism.

It gives me immense pleasure to express my regards to Miss Priyanka , Centre Academic, of Aptech Pitampura Centre, Delhi for his kind help. My special thanks to the talented and hard working folks at the Aptech Pitampura Centre for their valuable suggestions, and time through out my project.

KRISHNENDU.R.S APTECH PITAMPURA

OBJECTIVE OF E- PROJECT

REAL TIME WORK:

e-Project Team has assigned us a project entitled CHILDCARE. This is really a very challenging job for us to complete this project within 30 days. We were very much tensed for the project but it all became possible because of the pains our faculty bore with us and our team tried their best to achieve the milestone. Following is the schedule that we followed to accomplish this task: Pre-Production Work: I devoted 2 days for activities involved in Pre-Production. Production: I devoted 3days /operations involved in Production. for job

(i)

(ii)

(iii)

Post-Production: I kept 2 days for PostProduction activities.

Time Constraint: It was really a very tough task for us to complete this project with

in the timeframe allocated to us by e-Project Team.

PRE-PRODUCTION
OBJECTIVE S

Investigating the new problems, which occur the project development.

during

Apply all concepts of s/w engineering i.e. the of development of project.

process

Design and implement major component of s/w including database and front-end application modules.

framework

Development

and

integrate

different created

module

created

modules

and test the completed application. Reusability of legally system as web Smother interdepartmental integration

Increased and faster reach.

ISSUES: 1.

Standardization: - Standardization is an important

part of many data mining and data discovery processes. Standardization arises because certain objects may have many different textual strings or names associated with them.
2.

User interfaces availability: - Unified user

interface development has been introduced with the objective of supporting platform and user independent
interface development.

SYSTEM ANALYSIS.
Identification of Need It is the study of various operations performed by the system and their relationship in and outside the system. This study is used to gain an in depth understanding of the existing system and what is required from the new system. At the conclusion of the analysis phase there is a System description for the new system or a set of requirements of the new system. If there is no existing system then analysis defines only the requirements. System Analysis consists of five basic parts: System Planning And Initial Investigation Information Gathering The Tools of Structured Analysis Feasibility Study Cost I Benefit Analysis

System Planning And Initial Investigation This is the first step in project. To launch a system investigation a master plan detailing of the system to be taken , the people to be questioned and the expected outcome is required. The objective is to determine whether the user request has potential merit.

Information Gathering There are four key strategies or general approaches for. Eliciting information regarding the user's requirement: Asking Getting information from existing system Onsite observation. Prototyping

Each approach has its advantages and limitations these are described below: Asking

This is the approach where the information is gathered by directly asking the person about his problem requirements. Advantages It gives the users a feeling of participation. Helps to explore the details of the solution by

observing the facial expression, body language by listening to the verbal replies to the question.
Disadvantages

This process is time consuming. The success depends upon the analyst who is

conducting the interview. Sometimes the candidates hesitate.

Questionnaire
It is the study of various operations performed by the system and their relationship in and outside the system. This study is used to gain an in depth understanding of the existing system and what is required from the new system. At the conclusion of the analysis phase there is a system description for the new system or a set of requirements

of the new system. If there is no existing system then analysis defines only the requirements. They are special purpose documents that allow information gathering from a large number of people. Questionnaires are of two types i. Open ended: they allow the users to formulate

their answers ii. closed ended: there are specific questions which Advantages People can complete and return the questionnaire

look for answers as in Yes or No

at their convenience. Can be given to people who are very far. Response can be tabulated and organized very Disadvantage Number of respondents is very low. There is no surety of all the questions being

quickly.

answered. It is not possible to observe the respondents

expressions or body language. No method to verify a vague or incomplete answer.

The Tools of Structured Analysis Feasibility Study.


Feasibility study is done so that an iII-conceived system is recognized early in definition phase. During system engineering, however, we concentrate our attention on four primary areas of interests Economic Feasibility: An evaluation of development cost weighed against the ultimate income or benefit derived from the developed system. Technical Feasibility: A study of function, performance & constraints that may affect the ability to achieve an acceptable system.

Economic analysis
Among the most important information contained in a feasible study is Cost Benefit Analysis and assessment of the economic justification for a computer based system project. Cost benefit analysis delineates costs for the project development and weighs them against tangible (i.e. measurable directly in dollars) & intangible benefits of a system. Cost- benefits analysis is complicated by criteria that vary with the

characteristics of the system to be developed, the relative size of the project & the expected return on investment desired as part of the company's strategic plan. In addition many benefits derived from computer based systems tangible (e.g. better design quality through iterative optimization, increased customer satisfaction through programmable control & better decisions through reformatted & Pre-analyzed sales data). Direct Quantitative comparisons may be difficult to achieve.

Technical analysis
During technical analysis, analyst the technical merits of system concept, while at the same time collecting additional Information about performance, reliability, maintainability and predictability. Technical analysis begins with an assessment of the technical viability of the proposed system. What

technologies are required to accomplish system function and performance? What new materials, methods, algorithms or processes are required and what is their development risk? How will these obtained from technical analysis form the basis for another go/no-go decision on the test system? If technical risk severe, if models indicate that the desired function cannot be achieved, if the pieces just won't fit together smoothly its back to the drawing board.

Performance Requirements
The following performance characteristics were taken care of while developing System: User Friendliness: The system is easy to learn and understand. A native user can also use the system effectively, without any difficulty. User Satisfaction: The system is such that it stands up to the user expectations. Response Time: The response of all the operation is good. This has been made taken tare of to ensure that the system operates without halting.

Safety and Robustness: The system is able to avoid or tackle disastrous action. In other words, it should be full proof. The system safeguards against undesired events without human intervention.

Acceptance criteria
The following acceptance criteria were established for evaluation of the new system: 1. The system developed should be accurate and hence reliable i.e. the error rate should be minimized and the output should be accurate and consistent. 2. The developed software should provide all the functions. Further, the execution time should be very low and response should be good. 3. It should satisfy the criteria specified In functional & performance requirements. 4. The system should have scope to foresee modifications and enhancements i.e. it should be able to cope up with business changes.

5. The system must satisfy the standards of good software.

User Friendliness: The system should satisfy the user's need. It should be easy to learn & operate. Modularity: The system should have relatively Independent and single function parts that can be put together to make complete system. Maintainability: The developed system should be such that the time & effort for the program maintenance, enhancements are reduced. Timeliness: The system should operate well under peak & recovery conditions.

BASIS FOR DATA DICTIONARY

A data dictionary is a centralized collection of all data flowing among functions & to or from data stores. It is nothing but a repository of various data flows defined in a DFD. The associated data dictionary states precisely the structure of each data flow in the DFD.

The list of the various data structure along with their data type & description is as follows: Table-1 Login FieldName User Password Authorization Type Text Password Number Size 10 8 Not Null

Table 2 Persons Field Name Type Size Not Null

AutoNumber Long Integer Person_Id FirstName LastName MiddleName Nick Name Gender Martial Status Age BirthDate Address Res_Phone_Nu mber Text Text Text Text Text Text Number Date/Time Text Text 30 30 30 15 1 10 integer yyyy/mm/dd 30 15 15 15 30 30

Off_Phone_Num Text ber Cell_Number Email address Text Text Company Name Text

SYSTEM REQUIREMENTS
Hardware
Pentium V Processor RAM:- 1 GB Hard Disk:- 180 GB Other:-CD Writer

SOFTWARE
Front-end:- JAVA Back-end:- SQL For Connectivity:- JDBC

Production
WATERFALL MODEL
The project is based on waterfall technique, which is based on topdown approach. First I have discovered all the problems present in the current system and hence accordingly framed the requirements. After the identification of requirements I have froizen them i.e. no future requirements can be identified. The user will get finally whatever he desires without having ant intermediate interface. The Waterfall Model offers a means of making the developmemt process more visible.

Flow Chart
start Enter Login
If deatail matche d

Print Error Wrong user Name and Password

y es
Open Main Menu Module

End

For Customer Detail

DATA FLOW DIAGRAM


0 - LEVEL DFD

Ist level DFD

Source Code

PERSONELSYSTEM
/* -------------------------------------------------------------------------|System Name : Personnel Application System | |Description : A simple maintenance application system. It includes | | inquiry, update, delete, and insert functionalities | | of personnel(friends, loved ones, exgirlfriends, enemies,| | celebrities, etc.) | ---------------------------------------------------------------------------| |Author : Krishnendu.R.S | |Program Version: 1.0 | |JDK Version :1.5 | |Last Update : 22 APRIL 2011 | |Database : MS Access 2003 | |DB Name : personnel.mdb | |Tables : login, persons | |Primary Key : person_id | -------------------------------------------------------------------------*/ //----------------------------------------------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //----------------------------------------------------------------------------->>> import import import import import import import java.awt.*; java.awt.event.*; javax.swing.*; java.sql.*; java.io.*; java.util.Date; java.text.NumberFormat;

public class PersonnelSystem extends JFrame{ // Define constant variables final static String driver final static String url final static String login = "sun.jdbc.odbc.JdbcOdbcDriver"; = "jdbc:odbc:Personnel"; = "LOG-IN";

final final final Details"; final final final final final final final in!"; final final final final final final final final final final final final final

static String tab_login static String tab1 static String tab2 static static static static static static static static static static static static static static static static static static static static String String String String String String String String String String String String String String String String String String String String tab3 insert update delete inquire clear relogin

= "Log-in"; = "INQUIRE Personnel Details"; = "UPDATE/DELETE Personnel = "INSERT Personnel Details"; = "SAVE RECORD"; = "UPDATE RECORD"; = "DELETE RECORD"; = "INQUIRE RECORD"; = " CLEAR "; = "Log-in failed! Please relog= "No Record Found!"; = "Record Inserted!"; = "Record Updated!"; = "Record Deleted!"; = "Age should be numeric!"; = "INFORMATION"; = "ERROR"; = "GENERAL EXCEPTION"; = "SQL EXCEPTION"; = "CONFIRM DELETE"; "/"; "login"; "persons";

norecfound recinserted recupdated recdeleted numericerror information error genexception sqlexception confdelete slash = table1 = table2 =

// Define variables String sql = ""; String birthdate = ""; comboboxes of int pane_number be processed fields and comboboxes boolean abort avoid further = 0;

for general use // Used to store sql statements // Used to store birthdate format from // of year, month and day // Used to indicate what screen needs to // like resetting input

= false;// Used to indicate if error found to // processing/validations

// Define container, panels and tabbedpane Container cntr = getContentPane(); JTabbedPane tpane = new JTabbedPane(); JPanel datepanel1, datepanel2, datepanel3, cbpanel1 , cbpanel2 , cbpanel3, agepanel1 , agepanel2, agepanel3, panel1 , panel2 , panel3; // Define arrays for combo boxes String gender[] ={"Male","Female"}; String maritalstatus[] ={"Single","Married","Separated","Annulled","Divorced"}; // Setup constraints and type of layout GridBagConstraints constraints = new GridBagConstraints(); GridBagConstraints constraints1 = new GridBagConstraints(); GridBagConstraints constraints2 = new GridBagConstraints(); GridBagConstraints constraints3 = new GridBagConstraints(); GridBagLayout layout = new GridBagLayout ();

// Define fonts to be used Font labelFont = new Font("Arial",Font.PLAIN,12); Font buttonFont = new Font("Arial",Font.BOLD,13); // Define labels JLabel lbUser JLabel lbPassword JLabel lbSelectName JLabel lbFirstName JLabel lbLastName JLabel lbMiddleName JLabel lbNickName JLabel lbGender JLabel lbMaritalStatus JLabel lbAge JLabel lbBirthdate JLabel lbAddress JLabel lbResPhoneNumber JLabel lbCompanyName JLabel lbOffPhoneNumber JLabel lbCellNumber JLabel lbEmailAddress = new JLabel("Enter User ID: " ); = new JLabel("Enter Password: "); JLabel("Search Name: " ); = new JLabel("First Name: " ); = new JLabel("Last Name: " ); JLabel("Middle Name: " ); = new JLabel("Nickname: " ); JLabel("Gender: " ); JLabel("Marital Status: "); JLabel("Age: " ); = new JLabel("Birthdate: " ); JLabel("Address: " ); JLabel("Res. Phone No.: "); JLabel("Company Name: " ); JLabel("Off. Phone No.: "); JLabel("Cellphone No.: " ); JLabel("Email Address: " );

= new = new = new = new = new = = = = = = new new new new new new

// Define combo boxes in third screen (insert pane) JComboBox cbGender1 = new JComboBox(gender); JComboBox cbMaritalStatus1 = new JComboBox(maritalstatus); JComboBox cbYear1 = new JComboBox(); JComboBox cbMonth1 = new JComboBox(); JComboBox cbDay1 = new JComboBox(); JComboBox cbName1 = new JComboBox(); JComboBox cbPersonId1 = new JComboBox(); // Define combo boxes in second (update/delete pane) JComboBox cbGender2 = new JComboBox(gender); JComboBox cbMaritalStatus2 = new JComboBox(maritalstatus); JComboBox cbYear2 = new JComboBox(); JComboBox cbMonth2 = new JComboBox(); JComboBox cbDay2 = new JComboBox(); JComboBox cbName2 = new JComboBox(); JComboBox cbPersonId2 = new JComboBox(); // Define combo boxes in third screen (insert pane) JComboBox cbGender3 = new JComboBox(gender); JComboBox cbMaritalStatus3 = new JComboBox(maritalstatus); JComboBox cbYear3 = new JComboBox(); JComboBox cbMonth3 = new JComboBox(); JComboBox cbDay3 = new JComboBox(); // Define buttons, text fields and password field JButton btLogin = new JButton (login ); JButton btInsert = new JButton (insert ); JButton btUpdate = new JButton (update ); JButton btDelete = new JButton (delete ); JButton btInquire = new JButton (inquire); JButton btClear = new JButton (clear ); JPasswordField jpPassword = new JPasswordField(10 ); JTextField tfUser = new JTextField("",10 );

// Inquiry fields on first screen (inquiry pane) JTextField tfFirstName1 = new JTextField("",30); JTextField tfLastName1 = new JTextField("",30); JTextField tfMiddleName1 = new JTextField("",30); JTextField tfNickName1 = new JTextField("",15); JTextField tfAge1 = new JTextField("",3 ); JTextField tfAddress1 = new JTextField("",30); JTextField tfResPhoneNumber1 = new JTextField("",15); JTextField tfOffPhoneNumber1 = new JTextField("",15); JTextField tfCompanyName1 = new JTextField("",30); JTextField tfEmailAddress1 = new JTextField("",30); JTextField tfCellNumber1 = new JTextField("",15); JTextField tfYear1 = new JTextField("",4 ); JTextField tfMonth1 = new JTextField("",2 ); JTextField tfDay1 = new JTextField("",2 ); // Input fields on second screen JTextField tfFirstName2 = JTextField tfLastName2 JTextField tfMiddleName2 = JTextField tfNickName2 JTextField tfAge2 JTextField tfAddress2 JTextField tfResPhoneNumber2 JTextField tfOffPhoneNumber2 JTextField tfCompanyName2 JTextField tfEmailAddress2 JTextField tfCellNumber2 = JTextField tfYear2 JTextField tfMonth2 JTextField tfDay2 (update/delete pane) new JTextField("",30); = new JTextField("",30); new JTextField("",30); = new JTextField("",15); = new JTextField("",3 ); = new JTextField("",30); = new JTextField("",15); = new JTextField("",15); = new JTextField("",30); = new JTextField("",30); new JTextField("",15); = new JTextField("",4 ); = new JTextField("",2 ); = new JTextField("",2 );

// Input fields on third screen (insert pane) JTextField tfFirstName3 = new JTextField("",30); JTextField tfLastName3 = new JTextField("",30); JTextField tfMiddleName3 = new JTextField("",30); JTextField tfNickName3 = new JTextField("",15); JTextField tfAge3 = new JTextField("",3 ); JTextField tfAddress3 = new JTextField("",30); JTextField tfResPhoneNumber3 = new JTextField("",15); JTextField tfOffPhoneNumber3 = new JTextField("",15); JTextField tfCompanyName3 = new JTextField("",25); JTextField tfEmailAddress3 = new JTextField("",30); JTextField tfCellNumber3 = new JTextField("",15); JTextField tfYear3 = new JTextField("",4 ); JTextField tfMonth3 = new JTextField("",2 ); JTextField tfDay3 = new JTextField("",2 ); // class to convert ConvertValue conval // class to compute ComputeValue comval gender into char value for DB storing = new ConvertValue(); age based on birthyear = new ComputeValue();

//----------------------------------------------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start setupLoginPanel()----------------------------------->>>

// Setup the login screen public void setupLoginPanel(){ // set application title setTitle("Personnel Maintenance System"); // center screen setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - getWidth())/2, (Toolkit.getDefaultToolkit().getScreenSize().height - getHeight())/2); panel1 = new JPanel(); // set screen border panel1.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(),"")); // add tabbedpane to panel tpane.addTab(tab_login, panel1); // add panel to container cntr.add(tpane); // setup layout as GridBagLayout constraints.insets = new Insets(2,2,2,2); panel1.setLayout(layout); // setup User ID label in display area lbUser.setFont(labelFont); constraints.ipadx = 2; constraints.ipady = 2; constraints.gridx = 0; constraints.gridy = 0; constraints.anchor = GridBagConstraints.WEST; layout.setConstraints(lbUser, constraints); panel1.add(lbUser); // setup User ID input field in display area tfUser.setFont(labelFont); constraints.ipadx = 2; constraints.ipady = 2; constraints.gridx = 1; constraints.gridy = 0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(tfUser, constraints); panel1.add(tfUser); // setup Password label in display area lbPassword.setFont(labelFont); constraints.ipadx = 2; constraints.ipady = 2; constraints.gridx = 0; constraints.gridy = 1; constraints.anchor = GridBagConstraints.WEST;

layout.setConstraints(lbPassword, constraints); panel1.add(lbPassword); // setup Password input field in display area jpPassword.setEchoChar('*'); constraints.ipadx = 2; constraints.ipady = 2; constraints.gridx = 1; constraints.gridy = 1; layout.setConstraints(jpPassword, constraints); panel1.add(jpPassword); // setup Login button in display area btLogin.setFont(buttonFont); constraints.anchor = GridBagConstraints.WEST; constraints.gridy = 3; constraints.gridx = 1; layout.setConstraints(btLogin, constraints); panel1.add(btLogin); // setup login button listener btLogin.addActionListener(new ButtonHandler()); // allow ALT L to press login button btLogin.setMnemonic('l'); } //--------------------End setupLoginPanel()------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start login()--------------------------------------------->>> // Validate user input from the login screen based on information from login // table (note: manually create/update your login from table LOGIN). public void login(){ String user = tfUser.getText(); user = user.trim(); String password = jpPassword.getText(); sql = "SELECT * FROM login WHERE user='"+ user+"' AND password='"+password+"'"; try{ // load MS Access driver Class.forName(driver); }catch(java.lang.ClassNotFoundException ex){ JOptionPane.showMessageDialog(null,ex.getMessage(), error , } JOptionPane.PLAIN_MESSAGE);

try{ // setup connection to DBMS Connection conn = DriverManager.getConnection(url); // create statement Statement stmt = conn.createStatement(); // execute sql statement stmt.execute(sql); ResultSet rs = stmt.getResultSet(); boolean recordfound = rs.next(); if (recordfound){ tpane.removeTabAt(0); initComboBoxes(); showPane1(); showPane2(); showPane3();

} else{

// username/password invalid JOptionPane.showMessageDialog(null,relogin, error, JOptionPane.INFORMATION_MESSAGE); //clear login and password fields tfUser.setText (""); jpPassword.setText(""); } conn.close(); }catch(Exception ex){ genexception, } JOptionPane.showMessageDialog(null,ex.getMessage(), JOptionPane.INFORMATION_MESSAGE);

} //--------------------End login()----------------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start showPane1()----------------------------------------->>> // Setup screen 1(inquiry pane) including labels, input fields, comboboxes. // Table PERSONS is read to list inquiry parameters. void showPane1(){ panel1 datepanel1 cbpanel1 agepanel1 = = = = new new new new JPanel(); JPanel(); JPanel(); JPanel();

// set screen border panel1.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(),"")); // add tabbedpane to panel tpane.addTab(tab1, panel1); // setup layout as GridBagLayout constraints1.insets = new Insets(2,2,2,2); panel1.setLayout (layout); datepanel1.setLayout(layout); cbpanel1.setLayout (layout); agepanel1.setLayout (layout); // setup Name combobox label lbSelectName.setFont(labelFont); constraints1.gridx = 0; constraints1.gridy = 0; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbSelectName, constraints1); panel1.add(lbSelectName); // setup Name combobox as search key cbName1.setFont(labelFont); constraints1.ipady = 10; constraints1.gridx = 1; constraints1.gridy = 0; constraints1.gridwidth = 3; constraints1.anchor = GridBagConstraints.WEST; constraints1.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(cbName1, constraints1); panel1.add (cbName1); // setup search combobox (Name and corresponding key) cbName1.addItem ("Choose one:"); cbPersonId1.addItem("0"); // setup First Name label in display area lbFirstName.setFont(labelFont); constraints1.gridx = 0; constraints1.gridy = 1; constraints1.anchor = GridBagConstraints.WEST; constraints1.fill = GridBagConstraints.NONE; constraints1.gridwidth = 1; layout.setConstraints(lbFirstName, constraints1); panel1.add(lbFirstName); // setup First Name input field in display area tfFirstName1.setFont(labelFont); tfFirstName1.setEditable(false); constraints1.gridx = 1; constraints1.gridy = 1; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(tfFirstName1, constraints1); panel1.add(tfFirstName1); // setup Last Name label in display area

lbLastName.setFont(labelFont); constraints1.gridx = 2; constraints1.gridy = 1; constraints1.anchor = GridBagConstraints.WEST; constraints1.fill = GridBagConstraints.NONE; layout.setConstraints(lbLastName, constraints1); panel1.add(lbLastName); // setup Last Name input field in display area tfLastName1.setFont(labelFont); tfLastName1.setEditable(false); constraints1.gridx = 3; constraints1.gridy = 1; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(tfLastName1, constraints1); panel1.add(tfLastName1); // setup Middle Name label in display area lbMiddleName.setFont(labelFont); constraints1.gridx = 0; constraints1.gridy = 2; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbMiddleName, constraints1); panel1.add(lbMiddleName); // setup Middle Name input field in display area tfMiddleName1.setFont(labelFont); tfMiddleName1.setEditable(false); constraints1.gridx = 1; constraints1.gridy = 2; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(tfMiddleName1, constraints1); panel1.add(tfMiddleName1); // setup Nickname label in display area lbNickName.setFont(labelFont); constraints1.gridx = 2; constraints1.gridy = 2; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbNickName, constraints1); panel1.add(lbNickName); // setup Nickname input field in display area tfNickName1.setFont(labelFont); tfNickName1.setEditable(false); constraints1.gridx = 3; constraints1.gridy = 2; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(tfNickName1, constraints1); panel1.add(tfNickName1); // setup Gender label in display area lbGender.setFont(labelFont); constraints1.gridx = 0; constraints1.gridy = 3; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbGender, constraints1); panel1.add(lbGender);

// setup Gender input field in display area cbGender1.setFont(labelFont); cbGender1.setEnabled(false); constraints1.ipady = 8; constraints1.gridx = 1; constraints1.gridy = 3; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(cbGender1, constraints1); panel1.add(cbGender1); // setup Marital Status label in display area lbMaritalStatus.setFont(labelFont); constraints1.gridx = 2; constraints1.gridy = 3; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbMaritalStatus, constraints1); panel1.add(lbMaritalStatus); // setup Marital Status input field in display area cbMaritalStatus1.setFont(labelFont); cbMaritalStatus1.setEnabled(false); constraints1.ipady = 8; constraints1.gridx = 3; constraints1.gridy = 3; constraints1.gridwidth = GridBagConstraints.REMAINDER; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(cbMaritalStatus1, constraints1); panel1.add(cbMaritalStatus1); // setup Birthdate label in display area using another pane (datepanel2) lbBirthdate.setFont(labelFont); constraints1.gridx = 0; constraints1.gridy = 4; constraints1.anchor = GridBagConstraints.WEST; datepanel1.add(lbBirthdate); panel1.add(datepanel1, constraints1); // indicate inquiry pane pane_number = 1; // put values in inquiry comboboxes initComboBoxes(); accordingly // put separate panel(cbpanel) for these fields to align cbYear1.setFont(labelFont); cbMonth1.setFont(labelFont); cbDay1.setFont(labelFont); cbYear1.setEnabled(false); cbMonth1.setEnabled(false); cbDay1.setEnabled(false); constraints1.gridx = 1; constraints1.gridy = 4; constraints1.anchor = GridBagConstraints.WEST; cbpanel1.add(cbYear1); cbpanel1.add(cbMonth1); cbpanel1.add(cbDay1); panel1.add(cbpanel1, constraints1);

// setup Age label in display area lbAge.setFont(labelFont); constraints1.gridx = 3; constraints1.gridy = 4; constraints1.anchor = GridBagConstraints.WEST; agepanel1.add(lbAge); // setup Age input field in display area tfAge1.setFont(labelFont); tfAge1.setEditable(false); agepanel1.add(tfAge1); panel1.add(agepanel1, constraints1); // setup Address label in display area lbAddress.setFont(labelFont); constraints1.gridx = 0; constraints1.gridy = 5; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbAddress, constraints1); panel1.add(lbAddress); // setup Address input field in display area tfAddress1.setFont(labelFont); tfAddress1.setEditable(false); constraints1.gridx = 1; constraints1.gridy = 5; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(tfAddress1, constraints1); panel1.add(tfAddress1); // setup Residence Phone Number label in display area lbResPhoneNumber.setFont(labelFont); constraints1.gridx = 2; constraints1.gridy = 5; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbResPhoneNumber, constraints1); panel1.add(lbResPhoneNumber); // setup Residence Phone Number input field in display area tfResPhoneNumber1.setFont(labelFont); tfResPhoneNumber1.setEditable(false); constraints1.gridx = 3; constraints1.gridy = 5; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(tfResPhoneNumber1, constraints1); panel1.add(tfResPhoneNumber1); // setup Company Name label in display area lbCompanyName.setFont(labelFont); constraints1.gridx = 0; constraints1.gridy = 6; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbCompanyName, constraints1); panel1.add(lbCompanyName); // setup Company Name input field in display area tfCompanyName1.setFont(labelFont); tfCompanyName1.setEditable(false);

constraints1.gridx = 1; constraints1.gridy = 6; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(tfCompanyName1, constraints1); panel1.add(tfCompanyName1); // setup Office Phone Number label in display area lbOffPhoneNumber.setFont(labelFont); constraints1.gridx = 2; constraints1.gridy = 6; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbOffPhoneNumber, constraints1); panel1.add(lbOffPhoneNumber); // setup Office Phone Number input field in display area tfOffPhoneNumber1.setFont(labelFont); tfOffPhoneNumber1.setEditable(false); constraints1.gridx = 3; constraints1.gridy = 6; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(tfOffPhoneNumber1, constraints1); panel1.add(tfOffPhoneNumber1); // setup Email Address label in display area lbEmailAddress.setFont(labelFont); constraints1.gridx = 0; constraints1.gridy = 7; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbEmailAddress, constraints1); panel1.add(lbEmailAddress); // setup Email Address input field in display area tfEmailAddress1.setFont(labelFont); tfEmailAddress1.setEditable(false); constraints1.gridx = 1; constraints1.gridy = 7; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(tfEmailAddress1, constraints1); panel1.add(tfEmailAddress1); // setup Cell Number label in display area lbCellNumber.setFont(labelFont); constraints1.gridx = 2; constraints1.gridy = 7; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(lbCellNumber, constraints1); panel1.add(lbCellNumber); // setup Cell Number input field in display area tfCellNumber1.setFont(labelFont); tfCellNumber1.setEditable(false); constraints1.gridx = 3; constraints1.gridy = 7; constraints1.anchor = GridBagConstraints.WEST; layout.setConstraints(tfCellNumber1, constraints1); panel1.add(tfCellNumber1); // read table get the list of names in CB search key accessDBInit();

// define listener after adding items to CB to avoid triggering it cbName1.addItemListener(new ComboBoxHandler()); } //--------------------End showPane1()------------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start showPane2()----------------------------------------->>> // Setup screen 2(update and delete pane) including labels, input fields, // comboboxes, and buttons. Table PERSONS is read to list inquiry parameters. void showPane2(){ panel2 datepanel2 cbpanel2 agepanel2 = = = = new new new new JPanel(); JPanel(); JPanel(); JPanel();

labelFont = new Font("Arial",Font.PLAIN,12); buttonFont = new Font("Arial",Font.BOLD,12); // set screen border panel2.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(),"")); // add tabbedpane to panel tpane.addTab(tab2, panel2); // setup layout as GridBagLayout constraints2.insets = new Insets(2,2,2,2); panel2.setLayout (layout); datepanel2.setLayout(layout); cbpanel2.setLayout (layout); agepanel2.setLayout (layout); // setup Name combobox label lbSelectName = new JLabel("Search Name: "); lbSelectName.setFont(labelFont); constraints2.gridx = 0; constraints2.gridy = 0; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbSelectName, constraints2); panel2.add(lbSelectName); // setup Name combobox as search key cbName2 = new JComboBox(); cbName2.setFont(labelFont); constraints2.ipady = 10; constraints2.gridx = 1; constraints2.gridy = 0; constraints2.gridwidth = 3; constraints2.anchor = GridBagConstraints.WEST; constraints2.fill = GridBagConstraints.HORIZONTAL;

layout.setConstraints(cbName2, constraints2); panel2.add(cbName2); // setup search combobox (Name and corresponding key) cbName2.addItem("Choose one:"); cbPersonId2.addItem("0"); // setup First Name label in display area lbFirstName = new JLabel("First Name: "); lbFirstName.setFont(labelFont); constraints2.gridx = 0; constraints2.gridy = 1; constraints2.anchor = GridBagConstraints.WEST; constraints2.fill = GridBagConstraints.NONE; constraints2.gridwidth = 1; // layout.setConstraints(lbFirstName, constraints2); panel2.add(lbFirstName); // setup First Name input field in display area tfFirstName2.setFont(labelFont); constraints2.gridx = 1; constraints2.gridy = 1; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(tfFirstName2, constraints2); panel2.add(tfFirstName2); // setup Last Name label in display area lbLastName = new JLabel("Last Name: "); lbLastName.setFont(labelFont); constraints2.gridx = 2; constraints2.gridy = 1; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbLastName, constraints2); panel2.add(lbLastName); // setup Last Name input field in display area tfLastName2.setFont(labelFont); constraints2.gridx = 3; constraints2.gridy = 1; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(tfLastName2, constraints2); panel2.add(tfLastName2); // setup Middle Name label in display area lbMiddleName = new JLabel("Middle Name: "); lbMiddleName.setFont(labelFont); constraints2.gridx = 0; constraints2.gridy = 2; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbMiddleName, constraints2); panel2.add(lbMiddleName); // setup Middle Name input field in display area tfMiddleName2.setFont(labelFont); constraints2.gridx = 1; constraints2.gridy = 2; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(tfMiddleName2, constraints2); panel2.add(tfMiddleName2);

// setup Nickname label in display area lbNickName = new JLabel("Nickname: "); lbNickName.setFont(labelFont); constraints2.gridx = 2; constraints2.gridy = 2; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbNickName, constraints2); panel2.add(lbNickName); // setup Nickname input field in display area tfNickName2.setFont(labelFont); constraints2.gridx = 3; constraints2.gridy = 2; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(tfNickName2, constraints2); panel2.add(tfNickName2); // setup Gender label in display area lbGender = new JLabel("Gender: "); lbGender.setFont(labelFont); constraints2.gridx = 0; constraints2.gridy = 3; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbGender, constraints2); panel2.add(lbGender); // setup Gender input field in display area cbGender2.setFont(labelFont); constraints2.ipady = 8; constraints2.gridx = 1; constraints2.gridy = 3; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(cbGender2, constraints2); panel2.add(cbGender2); // setup Marital Status label in display area lbMaritalStatus = new JLabel("Marital Status: "); lbMaritalStatus.setFont(labelFont); constraints2.gridx = 2; constraints2.gridy = 3; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbMaritalStatus, constraints2); panel2.add(lbMaritalStatus); // setup Marital Status input field in display area cbMaritalStatus2.setFont(labelFont); constraints2.ipady = 8; constraints2.gridx = 3; constraints2.gridy = 3; constraints2.gridwidth = GridBagConstraints.REMAINDER; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(cbMaritalStatus2, constraints2); panel2.add(cbMaritalStatus2); // setup Birthdate label in display area using another pane (datepanel2) lbBirthdate = new JLabel("Birthdate:"); lbBirthdate.setFont(labelFont);

constraints2.gridx = 0; constraints2.gridy = 4; constraints2.anchor = GridBagConstraints.WEST; datepanel2.add(lbBirthdate); panel2.add(datepanel2, constraints2); // indicate update/delete pane pane_number = 2; // put values in update/delete combo boxes initComboBoxes(); // put separate panel(cbpanel) for these fields to align accordingly cbYear2.setFont(labelFont); cbMonth2.setFont(labelFont); cbDay2.setFont(labelFont); constraints2.gridx = 1; constraints2.gridy = 4; constraints2.anchor = GridBagConstraints.WEST; cbpanel2.add(cbYear2); cbpanel2.add(cbMonth2); cbpanel2.add(cbDay2); panel2.add(cbpanel2, constraints2); // setup Age label in display area lbAge = new JLabel ("Age:"); lbAge.setFont(labelFont); constraints2.gridx = 3; constraints2.gridy = 4; constraints2.anchor = GridBagConstraints.WEST; agepanel2.add(lbAge); // setup Age input field in display area tfAge2.setFont(labelFont); agepanel2.add(tfAge2); panel2.add(agepanel2, constraints2); // setup Address label in display area lbAddress = new JLabel("Address:"); lbAddress.setFont(labelFont); constraints2.gridx = 0; constraints2.gridy = 5; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbAddress, constraints2); panel2.add(lbAddress); // setup Address input field in display area tfAddress2.setFont(labelFont); constraints2.gridx = 1; constraints2.gridy = 5; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(tfAddress2, constraints2); panel2.add(tfAddress2); // setup Residence Phone Number label in display area lbResPhoneNumber = new JLabel("Res. Phone No.:"); lbResPhoneNumber.setFont(labelFont); constraints2.gridx = 2; constraints2.gridy = 5;

constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbResPhoneNumber, constraints2); panel2.add(lbResPhoneNumber); // setup Residence Phone Number input field in display area tfResPhoneNumber2.setFont(labelFont); constraints2.gridx = 3; constraints2.gridy = 5; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(tfResPhoneNumber2, constraints2); panel2.add(tfResPhoneNumber2); // setup Company Name label in display area lbCompanyName = new JLabel("Company Name:"); lbCompanyName.setFont(labelFont); constraints2.gridx = 0; constraints2.gridy = 6; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbCompanyName, constraints2); panel2.add(lbCompanyName); // setup Company Name input field in display area tfCompanyName2.setFont(labelFont); constraints2.gridx = 1; constraints2.gridy = 6; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(tfCompanyName2, constraints2); panel2.add(tfCompanyName2); // setup Office Phone Number label in display area lbOffPhoneNumber = new JLabel("Off. Phone No.:"); lbOffPhoneNumber.setFont(labelFont); constraints2.gridx = 2; constraints2.gridy = 6; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbOffPhoneNumber, constraints2); panel2.add(lbOffPhoneNumber); // setup Office Phone Number input field in display area tfOffPhoneNumber2.setFont(labelFont); constraints2.gridx = 3; constraints2.gridy = 6; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(tfOffPhoneNumber2, constraints2); panel2.add(tfOffPhoneNumber2); // setup Email Address label in display area lbEmailAddress = new JLabel("Email Address:"); lbEmailAddress.setFont(labelFont); constraints2.gridx = 0; constraints2.gridy = 7; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbEmailAddress, constraints2); panel2.add(lbEmailAddress); // setup Email Address input field in display area tfEmailAddress2.setFont(labelFont); constraints2.gridx = 1; constraints2.gridy = 7;

constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(tfEmailAddress2, constraints2); panel2.add(tfEmailAddress2); // setup Cell Number label in display area lbCellNumber = new JLabel("Cellphone No.:"); lbCellNumber.setFont(labelFont); constraints2.gridx = 2; constraints2.gridy = 7; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(lbCellNumber, constraints2); panel2.add(lbCellNumber); // setup Cell Number input field in display area tfCellNumber2.setFont(labelFont); constraints2.gridx = 3; constraints2.gridy = 7; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(tfCellNumber2, constraints2); panel2.add(tfCellNumber2); // setup UPDATE button in display area btUpdate.setFont(buttonFont); constraints2.gridx = 3; constraints2.gridy = 8; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(btUpdate, constraints2); panel2.add(btUpdate); // setup DELETE button in display area btDelete.setFont(buttonFont); constraints2.gridx = 1; constraints2.gridy = 8; constraints2.anchor = GridBagConstraints.WEST; layout.setConstraints(btDelete, constraints2); panel2.add(btDelete); btUpdate.addActionListener(new ButtonHandler()); btDelete.addActionListener(new ButtonHandler()); cbYear2.addItemListener (new ComboBoxHandler()); // allow ALT U to press update button btUpdate.setMnemonic('u'); // allow ALT D to press delete button btDelete.setMnemonic('d'); // read table get the list of names in combo box search key accessDBInit(); // define listener after adding items to CB to avoid triggering it cbName2.addItemListener(new ComboBoxHandler()); } //--------------------End showPane2()------------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start showPane3()----------------------------------------->>>

// Setup screen 2(insert pane) including labels, input fields, comboboxes, // and buttons. void showPane3(){ initComboBoxes(); panel3 = new JPanel(); // add panels to datepanel3 = new cbpanel3 = new agepanel3 = new align date label,combo box and age JPanel(); JPanel(); JPanel();

// set screen border panel3.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(),"")); // add tabbedpane to panel tpane.addTab(tab3, panel3); // setup layout as GridBagLayout constraints3.insets = new Insets(2,2,2,2); panel3.setLayout (layout); datepanel3.setLayout(layout); cbpanel3.setLayout (layout); agepanel3.setLayout (layout); // setup First Name label in display area JLabel lbFirstName = new JLabel("First Name:"); lbFirstName.setFont(labelFont); constraints3.gridx = 0; constraints3.gridy = 0; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbFirstName, constraints3); panel3.add(lbFirstName); // setup First Name input field in display area tfFirstName3.setFont(labelFont); constraints3.ipady = 8; // adjust heigth of input field constraints3.gridx = 1; constraints3.gridy = 0; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(tfFirstName3, constraints3); panel3.add(tfFirstName3); // setup Last Name label in display area lbLastName = new JLabel("Last Name: "); lbLastName.setFont(labelFont); constraints3.gridx = 2; constraints3.gridy = 0; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbLastName, constraints3); panel3.add(lbLastName); // setup Last Name input field in display area tfLastName3.setFont(labelFont); constraints3.gridx = 3;

constraints3.gridy = 0; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(tfLastName3, constraints3); panel3.add(tfLastName3); // setup Middle Name label in display area lbMiddleName = new JLabel("Middle Name: "); lbMiddleName.setFont(labelFont); constraints3.gridx = 0; constraints3.gridy = 1; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbMiddleName, constraints3); panel3.add(lbMiddleName); // setup Middle Name input field in display area tfMiddleName3.setFont(labelFont); constraints3.gridx = 1; constraints3.gridy = 1; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(tfMiddleName3, constraints3); panel3.add(tfMiddleName3); // setup Nickname label in display area lbNickName = new JLabel("Nickname: "); lbNickName.setFont(labelFont); constraints3.gridx = 2; constraints3.gridy = 1; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbNickName, constraints3); panel3.add(lbNickName); // setup Nickname input field in display area tfNickName3.setFont(labelFont); constraints3.gridx = 3; constraints3.gridy = 1; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(tfNickName3, constraints3); panel3.add(tfNickName3); // setup Gender label in display area lbGender = new JLabel("Gender: "); lbGender.setFont(labelFont); constraints3.gridx = 0; constraints3.gridy = 2; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbGender, constraints3); panel3.add(lbGender); // setup Gender input field in display area cbGender3.setFont(labelFont); constraints3.ipady = 8; constraints3.gridx = 1; constraints3.gridy = 2; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(cbGender3, constraints3); panel3.add(cbGender3); // setup Marital Status label in display area lbMaritalStatus = new JLabel("Marital Status: ");

lbMaritalStatus.setFont(labelFont); constraints3.gridx = 2; constraints3.gridy = 2; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbMaritalStatus, constraints3); panel3.add(lbMaritalStatus); // setup Marital Status input field in display area cbMaritalStatus3.setFont(labelFont); constraints3.ipady = 8; constraints3.gridx = 3; constraints3.gridy = 2; constraints3.gridwidth = GridBagConstraints.REMAINDER; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(cbMaritalStatus3, constraints3); panel3.add(cbMaritalStatus3); // setup Date label in display area using another pane (datepanel) lbBirthdate = new JLabel("Birthdate: "); lbBirthdate.setFont(labelFont); constraints3.gridx = 0; constraints3.gridy = 3; constraints3.anchor = GridBagConstraints.WEST; datepanel3.add(lbBirthdate); panel3.add(datepanel3, constraints3); // put separate panel(cbpanel) for these fields to align accordingly cbYear3.setFont(labelFont); cbMonth3.setFont(labelFont); cbDay3.setFont(labelFont); constraints3.ipady = 8; constraints3.gridx = 1; constraints3.gridy = 3; constraints3.anchor = GridBagConstraints.WEST; cbpanel3.add(cbYear3); cbpanel3.add(cbMonth3); cbpanel3.add(cbDay3); panel3.add(cbpanel3, constraints3); // setup Age label in display area lbAge = new JLabel ("Age:"); lbAge.setFont(labelFont); constraints3.gridx = 3; constraints3.gridy = 3; constraints3.anchor = GridBagConstraints.WEST; agepanel3.add(lbAge); // setup Age input field in display area agepanel3.add(tfAge3); tfAge3.setFont(labelFont); panel3.add(agepanel3, constraints3); // setup Address label in display area lbAddress = new JLabel ("Address:"); lbAddress.setFont(labelFont); constraints3.gridx = 0; constraints3.gridy = 4;

constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbAddress, constraints3); panel3.add(lbAddress); // setup Address input field in display area tfAddress3.setFont(labelFont); constraints3.gridx = 1; constraints3.gridy = 4; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(tfAddress3, constraints3); panel3.add(tfAddress3); // setup Residence Phone Number label in display area lbResPhoneNumber = new JLabel ("Res. Phone No.:"); lbResPhoneNumber.setFont(labelFont); constraints3.gridx = 2; constraints3.gridy = 4; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbResPhoneNumber, constraints3); panel3.add(lbResPhoneNumber); // setup Residence Phone Number input field in display area tfResPhoneNumber3.setFont(labelFont); constraints3.gridx = 3; constraints3.gridy = 4; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(tfResPhoneNumber3, constraints3); panel3.add(tfResPhoneNumber3); // setup Company Name label in display area lbCompanyName = new JLabel ("Company Name:"); lbCompanyName.setFont(labelFont); constraints3.gridx = 0; constraints3.gridy = 5; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbCompanyName, constraints3); panel3.add(lbCompanyName); // setup Company Name input field in display area tfCompanyName3.setFont(labelFont); constraints3.gridx = 1; constraints3.gridy = 5; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(tfCompanyName3, constraints3); panel3.add(tfCompanyName3); // setup Office Phone Number label in display area lbOffPhoneNumber = new JLabel ("Off. Phone No.:"); lbOffPhoneNumber.setFont(labelFont); constraints3.gridx = 2; constraints3.gridy = 5; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbOffPhoneNumber, constraints3); panel3.add(lbOffPhoneNumber); // setup Office Phone Number input field in display area tfOffPhoneNumber3.setFont(labelFont); constraints3.gridx = 3; constraints3.gridy = 5;

constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(tfOffPhoneNumber3, constraints3); panel3.add(tfOffPhoneNumber3); // setup Email Address label in display area lbEmailAddress = new JLabel ("Email Address:"); lbEmailAddress.setFont(labelFont); constraints3.gridx = 0; constraints3.gridy = 6; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbEmailAddress, constraints3); panel3.add(lbEmailAddress); // setup Email Address input field in display area tfEmailAddress3.setFont(labelFont); constraints3.gridx = 1; constraints3.gridy = 6; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(tfEmailAddress3, constraints3); panel3.add(tfEmailAddress3); // setup Cell Number label in display area lbCellNumber = new JLabel ("Cellphone No.:"); lbCellNumber.setFont(labelFont); constraints3.gridx = 2; constraints3.gridy = 6; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(lbCellNumber, constraints3); panel3.add(lbCellNumber); // setup Cell Number input field in display area tfCellNumber3.setFont(labelFont); constraints3.gridx = 3; constraints3.gridy = 6; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(tfCellNumber3, constraints3); panel3.add(tfCellNumber3); // setup INSERT button in display area btInsert.setFont(buttonFont); constraints3.gridx = 3; constraints3.gridy = 7; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(btInsert, constraints3); panel3.add(btInsert); // setup CLEAR button in display area btClear.setFont(buttonFont); constraints3.gridx = 1; constraints3.gridy = 7; constraints3.anchor = GridBagConstraints.WEST; layout.setConstraints(btClear, constraints3); panel3.add(btClear); pane_number = 3; initComboBoxes(); btInsert.addActionListener(new ButtonHandler btClear.addActionListener (new ButtonHandler

()); ());

// allow ALT S to press insert button btInsert.setMnemonic('s'); // allow ALT C to press clear button btClear.setMnemonic ('c'); // add listener to CB Year to compute for age cbYear3.addItemListener (new ComboBoxHandler());

} //--------------------End showPane3()------------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start initComboBoxes()------------------------------------>>> // Setup comboboxes particularly birth date, gender and marital status. void initComboBoxes(){ // years listed in year combo box for(int yr = 1960; yr < 2000; yr++) switch(pane_number){ // inquire pane case 1: cbYear1.addItem(String.valueOf(yr)); break; // update/delete pane case 2: cbYear2.addItem(String.valueOf(yr)); // insert pane break; case 3: cbYear3.addItem(String.valueOf(yr));} // list of months in month combo box String[] months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; for(int m = 0; m < 12; m++){ switch(pane_number){ // inquire pane case 1: cbMonth1.addItem(String.valueOf(months[m])); break; // update/delete pane case 2: cbMonth2.addItem(String.valueOf(months[m])); break; // insert pane case 3: cbMonth3.addItem(String.valueOf(months[m]));} } // set integer format to 2 digits (00) NumberFormat nf = NumberFormat.getInstance(); nf.setMinimumIntegerDigits(2); // list of day in days combo box for(int day = 1; day < 32; day ++){

} } //--------------------End initComboBoxes()-------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start accessDBInit()-------------------------------------->>> // This will read the table PERSONS to list the names of personnel that are // exisiting from the database. void accessDBInit(){ try{ + sql = "SELECT person_id, first_name, last_name FROM " table2 +" ORDER BY last_name"; // load MS Access driver Class.forName(driver); // Setup connection to DBMS Connection conn=DriverManager.getConnection(url); // Create statement Statement stmt = conn.createStatement(); boolean hasResults = stmt.execute(sql); if(hasResults){ ResultSet result = stmt.getResultSet(); displayResultsInit(result); } conn.close(); }catch(Exception ex){ JOptionPane.showMessageDialog(null, ex.getMessage(),genexception, JOptionPane.PLAIN_MESSAGE); } } //--------------------End accessDBInit()---------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start displayResultsInit()-------------------------------->>> // Put the names of personnels read into the ComboBox Name which will be used // as the search parameters for users. void displayResultsInit(ResultSet rs) throws SQLException{

switch(pane_number){ // inquire pane case 1: cbDay1.addItem(nf.format(day)); break; // update/delete pane case 2: cbDay2.addItem(nf.format(day)); break; // insert pane case 3: cbDay3.addItem(nf.format(day));}

while(rs.next()){ // get values to display in Name combo box: // concatenate last and first names String name= rs.getString("last_name") + "," + rs.getString("first_name"); // store person_id(unique identifier) // to display corresponding person details later String person_id = rs.getString("person_id"); switch(pane_number){ case 1: // inquiry screen // put Names in search combo box cbName1.addItem(name); cbPersonId1.addItem(person_id); break; case 2: // update/delete screen // put Names in search combo box cbName2.addItem(name); cbPersonId2.addItem(person_id);

} }

} //--------------------End displayResultsInit()---------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start updateRecord()-------------------------------------->>> // Update personnel details. void updateRecord(){ // convert combobox date input into String String birthdate = (String)cbYear2.getSelectedItem() + slash + + 1) + slash + (String)cbDay2.getSelectedItem(); gender // convert combobox gender into corresponding char value of (cbMonth2.getSelectedIndex()

String gender = conval.formatGender((String)cbGender2.getSelectedItem()); int age = 0; try{ // convert age into integer format age = Integer.parseInt(tfAge2.getText()); }catch(Exception e){ // error: age input is non-numeric

JOptionPane.showMessageDialog(null, numericerror,genexception, JOptionPane.INFORMATION_MESSAGE); tfAge2.setText(""); // set cursor to age input field for re-input tfAge2.requestFocus(); abort = true; return; } try{ // load MS Access driver Class.forName(driver); // Setup connection to DBMS Connection conn = DriverManager.getConnection(url); // Create statement Statement stmt = conn.createStatement(); sql = "UPDATE "+ table2+ " SET "+ "first_name = '" + "'," + + "'," + tfMiddleName2.getText() + "'," + + "'," + "last_name = '" "middle_name = '" + "'," + "nickname= '" "gender = '"

+ tfFirstName2.getText() + tfLastName2.getText() + + tfNickName2.getText() + gender

"maritalstatus= '" + (String)cbMaritalStatus2.getSelectedItem()+"',"+ "age = " + age + "," + "birthdate= '" + birthdate + "'," + "address = '" + tfAddress2.getText() + "'," + "res_phone_number = '"+ tfResPhoneNumber2.getText()+"',"+ "off_phone_number = '"+ tfOffPhoneNumber2.getText()+"',"+ "cell_number = '" + tfCellNumber2.getText() + "'," + "company_name = '" + tfCompanyName2.getText() + "'," + "email_address = '" + tfEmailAddress2.getText()+ "' " + "WHERE person_id = " + cbPersonId2.getSelectedItem().toString(); stmt.executeUpdate(sql); conn.close(); JOptionPane.showMessageDialog(null,recupdated, information, JOptionPane.INFORMATION_MESSAGE);

}catch(Exception ex){ JOptionPane.showMessageDialog(null, ex.getMessage() + ex.toString(),genexception, JOptionPane.INFORMATION_MESSAGE); } } //--------------------End updateRecord()---------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start deleteRecord()-------------------------------------->>> // Delete personnel records. void deleteRecord(){ try{ // load MS Access driver Class.forName(driver); // Setup connection to DBMS Connection conn = DriverManager.getConnection(url); // Create statement Statement stmt = conn.createStatement(); sql = "DELETE FROM "+ table2+ " WHERE person_id = " + cbPersonId2.getSelectedItem().toString(); stmt.executeUpdate(sql); conn.close(); JOptionPane.showMessageDialog(null,recdeleted, information, JOptionPane.INFORMATION_MESSAGE); }catch(Exception ex){ JOptionPane.showMessageDialog(null, ex.getMessage() + ex.toString(),genexception, JOptionPane.INFORMATION_MESSAGE); } } //--------------------End deleteRecord()---------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start insertRecord()-------------------------------------->>> // Insert personnel details. void insertRecord(){ // convert combobox date input into String String birthdate = (String)cbYear3.getSelectedItem() + slash + + 1) + slash + (cbMonth3.getSelectedIndex()

(String)cbDay3.getSelectedItem(); // convert combobox gender into corresponding char value of

gender

String gender = conval.formatGender((String)cbGender3.getSelectedItem()); int age = 0; try{ // convert age into integer format age = Integer.parseInt(tfAge3.getText()); }catch(Exception e){ // error: age input is non-numeric JOptionPane.showMessageDialog(null, numericerror,genexception, JOptionPane.INFORMATION_MESSAGE); tfAge3.setText(""); // set cursor to age input field for re-input tfAge3.requestFocus(); abort = true; return; } try{ // load MS Access driver Class.forName(driver); // Setup connection to DBMS Connection conn = DriverManager.getConnection(url); // Create statement Statement stmt = conn.createStatement(); sql = "INSERT INTO "+ table2+ " ("+ "first_name,"+ "last_name,"+ "middle_name,"+ "nickname,"+ "gender,"+ "maritalstatus,"+ "age,"+ "birthdate,"+ "address,"+ "res_phone_number,"+ "off_phone_number,"+ "cell_number,"+ "company_name,"+ "email_address"+ ") VALUES ('"+ tfFirstName3.getText()+ "','"+ tfLastName3.getText()+ "','"+ tfMiddleName3.getText()+ "','"+

tfNickName3.getText()+ "','"+ gender+ "','"+ (String)cbMaritalStatus3.getSelectedItem()+ "',"+ age+ ",'"+ birthdate+ "','"+ tfAddress3.getText()+ "','"+ tfResPhoneNumber3.getText()+ "','"+ tfOffPhoneNumber3.getText()+ "','"+ tfCellNumber3.getText()+ "','"+ tfCompanyName3.getText()+ "','"+ tfEmailAddress3.getText()+ "')"; stmt.executeUpdate(sql); conn.close(); information, JOptionPane.showMessageDialog(null,recinserted, JOptionPane.INFORMATION_MESSAGE); }catch(Exception ex){ JOptionPane.showMessageDialog(null, ex.getMessage() + ex.toString(),genexception, JOptionPane.INFORMATION_MESSAGE); } } //--------------------End insertRecord()---------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start selectRecord()-------------------------------------->>> // Read personnel table based on the selected item from the Combobox Name. void selectRecord(long person_id){ try{ // select person details based on primary key person_id sql = "SELECT * FROM "+table2+" WHERE person_id = "+person_id; // load MS Access driver Class.forName(driver); }catch (ClassNotFoundException x){ JOptionPane.showMessageDialog(null, x.getMessage(), "ClassNotFoundException", JOptionPane.PLAIN_MESSAGE); }

try{ // Setup connection to DBMS Connection conn = DriverManager.getConnection(url); // Create statement Statement stmt = conn.createStatement(); // execute sql statement boolean hasResults = stmt.execute(sql); if(hasResults){ ResultSet rs = stmt.getResultSet(); displayPersonDetails(rs);

} else {

// no record found JOptionPane.showMessageDialog(null, norecfound, information, JOptionPane.INFORMATION_MESSAGE); } conn.close();

}catch(Exception ex){ JOptionPane.showMessageDialog(null, ex.getMessage(),genexception, JOptionPane.PLAIN_MESSAGE); } } //--------------------End selectRecord()---------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start displayPersonDetails()------------------------------>>> // Populate details screen with data from personnel database. void displayPersonDetails(ResultSet rs)throws SQLException{ while (rs.next()){ int num1 = conval.displayGender( rs.getString("gender")); = conval.displayMaritalStatus(

int

num2

rs.getString("maritalstatus")); String date = rs.getString("birthdate"); // display details switch(pane_number){ case 1: // inquiry screen tfFirstName1.setText (rs.getString("first_name" )); tfLastName1.setText (rs.getString("last_name" )); tfMiddleName1.setText (rs.getString("middle_name" ));

tfNickName1.setText )); tfAddress1.setText (rs.getString("address" )); (rs.getString("nickname" tfResPhoneNumber1.setText(rs.getString("res_phone_number")); tfOffPhoneNumber1.setText(rs.getString("off_phone_number")); tfCellNumber1.setText (rs.getString("cell_number" )); tfCompanyName1.setText (rs.getString("company_name" )); tfEmailAddress1.setText (rs.getString("email_address" )); // display gender cbGender1.setSelectedIndex(num1); // display marital status cbMaritalStatus1.setSelectedIndex(num2); // display age tfAge1.setText (rs.getString("age").toString()); // display year of birth cbYear1.setSelectedItem (conval.displayYear(date)); // display month of birth cbMonth1.setSelectedIndex((conval.displayMonth(date)) -1); // display day of birth cbDay1.setSelectedItem (conval.displayDay(date)); break; case 2: // update/delete screen tfFirstName2.setText (rs.getString("first_name" )); tfLastName2.setText (rs.getString("last_name" )); tfMiddleName2.setText (rs.getString("middle_name" )); tfNickName2.setText (rs.getString("nickname" )); tfAddress2.setText (rs.getString("address" )); tfResPhoneNumber2.setText(rs.getString("res_phone_number")); tfOffPhoneNumber2.setText(rs.getString("off_phone_number")); tfCellNumber2.setText (rs.getString("cell_number" )); tfCompanyName2.setText (rs.getString("company_name" )); tfEmailAddress2.setText (rs.getString("email_address" )); // display gender cbGender2.setSelectedIndex(num1); // display marital status cbMaritalStatus2.setSelectedIndex(num2); // display age

tfAge2.setText (rs.getString("age").toString()); // display year of birth cbYear2.setSelectedItem (conval.displayYear(date)); // display month of birth cbMonth2.setSelectedIndex((conval.displayMonth(date)) -1); // display day of birth cbDay2.setSelectedItem (conval.displayDay(date)); } } } //--------------------End displayPersonDetails()-------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start clearDetails()-------------------------------------->>> // Reset screen input fields and initialize comboboxes. void clearDetails(){ switch(pane_number){ case 1: // clear date, gender and marital status comboboxes clearComboBoxes(); // clear search combobox cbName1.removeAllItems(); cbPersonId1.removeAllItems(); // initialize search combobox cbName1.addItem("Choose one:"); cbPersonId1.addItem("0"); cbName1.setSelectedItem("Choose one:"); // clear input fields tfFirstName1.setText (""); tfLastName1.setText (""); tfMiddleName1.setText (""); tfNickName1.setText (""); tfAge1.setText (""); tfAddress1.setText (""); tfResPhoneNumber1.setText(""); tfOffPhoneNumber1.setText(""); tfCellNumber1.setText (""); tfCompanyName1.setText (""); tfEmailAddress1.setText (""); break; case 2: // clear date, gender and marital status clearComboBoxes(); // clear search combobox cbName2.removeAllItems(); cbPersonId2.removeAllItems();

comboboxes

// initialize search combobox cbName2.addItem("Choose one:"); cbPersonId2.addItem("0"); cbName2.setSelectedItem("Choose one:"); // clear input fields tfFirstName2.setText (""); tfLastName2.setText (""); tfMiddleName2.setText (""); tfNickName2.setText (""); tfAge2.setText (""); tfAddress2.setText (""); tfResPhoneNumber2.setText(""); tfOffPhoneNumber2.setText(""); tfCellNumber2.setText (""); tfCompanyName2.setText (""); tfEmailAddress2.setText (""); break; case 3: clearComboBoxes(); tfFirstName3.setText (""); tfLastName3.setText (""); tfMiddleName3.setText (""); tfNickName3.setText (""); tfAge3.setText (""); tfAddress3.setText (""); tfResPhoneNumber3.setText(""); tfOffPhoneNumber3.setText(""); tfCellNumber3.setText (""); tfCompanyName3.setText (""); tfEmailAddress3.setText (""); ;} } //--------------------End clearDetails()---------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start clearComboBoxes()----------------------------------->>> // Initialize the comboboxes (birthdate, gender and marital status). void clearComboBoxes(){ switch(pane_number){ case 1: // clear comboboxes of inquiry screen cbYear1.setSelectedIndex (0); cbMonth1.setSelectedIndex (0); cbDay1.setSelectedIndex (0); cbGender1.setSelectedIndex (0); cbMaritalStatus1.setSelectedIndex(0); break; case 2: // clear comboboxes of update/delete screen cbYear2.setSelectedIndex (0); cbMonth2.setSelectedIndex (0); cbDay2.setSelectedIndex (0);

cbGender2.setSelectedIndex (0); cbMaritalStatus2.setSelectedIndex(0); break; case 3: // clear comboboxes of insert screen cbYear3.setSelectedIndex (0); cbMonth3.setSelectedIndex (0); cbDay3.setSelectedIndex (0); cbGender3.setSelectedIndex (0); cbMaritalStatus3.setSelectedIndex(0); ;} } //--------------------End clearComboBoxes()------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start ButtonHandler--------------------------------------->>> // Action listener for the buttons on each screen class ButtonHandler implements ActionListener{ public void actionPerformed(ActionEvent e){ // get the label of the button String action = e.getActionCommand(); if (action!=null){ if(action==login){ // call method accessDB() login(); // if login error, set cursor to user name tfUser.requestFocus(); } else if (action==insert){ insertRecord(); // refresh list of names in combo box search key // of inquiry screen

input field

if (abort){ // error found in insert abort = false; return; } else{ pane_number = 1; clearDetails(); accessDBInit(); // refresh list of names in combo box search key of // update/delete screen pane_number = 2; clearDetails(); accessDBInit(); tfFirstName3.requestFocus(); } } else if (action==update){

updateRecord(); if (abort){ // error found in update abort = false; return; } else{ // refresh inquiry screen pane_number = 1; clearDetails(); accessDBInit(); tfFirstName2.requestFocus(); } } else if (action==delete){ // ask user to confirm delete int reply = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete?", confdelete, JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.YES_OPTION){ // delete confirmed deleteRecord(); // refresh all screens pane_number = 1; clearDetails(); // setup inquiry search key CB accessDBInit(); pane_number = 2; clearDetails(); // setup update/delete search key CB accessDBInit();

} } else{

} }

// clear button - refresh insert pane pane_number = 3; clearDetails(); clearComboBoxes();

} } //--------------------End ButtonHandler----------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start ComboBoxHandler------------------------------------->>>

// Item listener for the Comboboxes on each screen class ComboBoxHandler implements ItemListener{ public void itemStateChanged(ItemEvent e){ if (e.getItemSelectable().equals(cbName1)){ // combobox from inquiry pane (search name) = "Choose one:" if (cbName1.getSelectedIndex() != 0){ // index 0 // get index clicked int num = (cbName1.getSelectedIndex()); // get corresponding primary key for sql purposes DB) cbPersonId1.setSelectedIndex(num); // convert person_id text into integer(format in long person_id = Integer.parseInt( cbPersonId1.getSelectedItem().toString()); pane_number = 1; // call method to execute sql and display details on screen selectRecord(person_id); } } else if (e.getItemSelectable().equals(cbName2)){ // combobox from update/delete pane (search name) = "Choose one:" if (cbName2.getSelectedIndex() != 0){ // index 0 // get index clicked int num = (cbName2.getSelectedIndex()); // get corresponding primary key for sql purposes integer(format in DB) cbPersonId2.setSelectedIndex(num); // convert person_id text into long person_id = Integer.parseInt( cbPersonId2.getSelectedItem().toString()); pane_number = 2; // call method to execute sql and display details on screen selectRecord(person_id); } } else if (e.getItemSelectable().equals(cbYear2)){ // birth year selected // update/delete screen // compute age according to year of birth String year = cbYear2.getSelectedItem().toString(); tfAge2.setText(comval.computeAge(year)); }

else if (e.getItemSelectable().equals(cbYear3)){// birth year selected // insert screen // compute age according to year of birth String year = cbYear3.getSelectedItem().toString(); tfAge3.setText(comval.computeAge(year)); } } } //--------------------End ComboBoxHandler--------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //--------------------Start main------------------------------------------------>>> public static void main(String args[]){ System.out.println("loading.......please wait."); PersonnelSystem app = new PersonnelSystem(); app.setSize(900,385); app.setupLoginPanel(); app.setVisible(true); app.tfUser.requestFocus(); app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } //--------------------End main-------------------------------------------------->>> //////////////////////////////////////////////////////////////////////// //////// //-----Quote:"Bugs are indication that we programmers are mere mortals!"---:)--->>>

COMPUTEAGE
import java.util.Calendar; import java.lang.Integer; class ComputeValue{ public String computeAge(String year){ Calendar cal = Calendar.getInstance(); // compute age based on current year and birthyear int age = cal.get(cal.YEAR) - Integer.parseInt(year); // return age as string return age + ""; } }

CONVERTVALUE
class ConvertValue{

final static String male final static String female final static String m final static String f final static String single

= "Male"; = "Female";

= "M"; = "F"; = "Single";

final static String married = "Married"; final static String separated = "Separated"; final static String annulled = "Annulled";

public String formatGender(String gender){

if (gender.equalsIgnoreCase(male)) // gender is male

return m; else // gender is female return f;

public int displayGender(String gender){

if (gender.equalsIgnoreCase(m))

// gender is male, // return equivalent index of male(0) in combo box return 0; else // gender is female, // return equivalent index of female(1) in combo box return 1; }

public int displayMaritalStatus(String status){

if (status.equalsIgnoreCase(single))

// marital status = single return 0;

else if (status.equalsIgnoreCase(married))

// marital status = married return 1;

else if (status.equalsIgnoreCase(separated))

//marital status = separated

return 2;

else if (status.equalsIgnoreCase(annulled))

//marital status = annulled return 3;

else //marital status = divorced return 4; }

public String displayYear(String date){

// parse 4 character year from String date String year = date.substring(0,4); return year;

public int displayMonth(String date){

// parse 2 character month from String date, then convert to integer int month = Integer.parseInt(date.substring(5,7)); return month; }

public String displayDay(String date){

// parse 2 character day from String date String day = date.substring(8,10); return day;

} }

Secreen Shot

Login Screen

Personnel Management System Inquire Form

Update/Delete Form

Insert form

POST-PRODUCTION
TESTING System Testing Testing a program consists of providing the program with a set of test inputs (or test cases) and observing if the program behaves as expected. If the program fails to behave as expected, then the conditions under which the failure occurs are noted for debugging and correction. A failure, fault, test case, test suit are few of the terms commonly associated with testing. A failure is a manifestation of an error (or defect or

bug). But, the mere presence of an error may not necessarily lead to a failure. A fault is an incorrect intermediate state that may

have been entered during program execution. A fault mayor may not lead to a failure. A test case is the triplet [I, S, 0] where I is the data

input to the system, 5 is the state of the system at

which the data is input, and 0 is the expected output of the system. A test suit is the set of all test cases with which a

given software product is to be tested.


Verification

It is the process of determining whether one phase of a software product conforms to its previous phase. Thus verification is concerned with phase containment of errors.

Validation It is the process of determining whether a fully developed system conforms to the requirement specification. The aim of validation is to make the final product error free.

Design of Test Cases

Exhaustive testing of almost any non-trivial system is impractical due to the fact that the domain of input data values to most practical software systems is either too

large or infinite. Therefore, it is essential to design an optimal test suit that is reasonable in size and

can detect as many errors as possible. Also the testing of a system using a large number of test cases selected randomly do not guarantee that all (or even most) of the errors in the system will be uncovered. There are essentially two main approaches to designing test cases: 1. 2. Black-box approach White-box (or glass-box) approach

In black-box approach, test cases are designed using only the functional specification of software, i.e. without any knowledge of internal structure of the software. For this reason this testing Is also known as functional testing.

On the other hand designing of white-box test cases requires thorough knowledge of the internal structure

of the software, and therefore the white box testing is also called structured testing. Because of the large amount of project effort associated with the system development, it becomes quit necessary to undertake well planned and through testing. Inadequate testing &. little testing lead's to errors that may be costly when they appear months later. Effective testing translates into cost savings from reduced errors &. Saves a lot of project efforts. It follows major factors that decide the occurrences

of errors in a new design from the very early stage of the development. 1. Communication between the user. The designer This factor is handled by frequently communicating

with the security officers.

2. The Time factor for the design This factor is handled by giving comparatively

more time to the designing of the system.


Objectives of System Testing

Once a system has been designed, it is necessary to undergo an exhaustive testing before installing the system. This is important because in some cases a small error, not detected and corrected early before installation, may explode into a much large problem later on. Testing is being performed when users are asked to assist in identifying all possible situations. That might arise as regards the factor that efforts were put to tackle the problem under consideration. A plan was decided for testing the system. The complete testing procedure was divided into several steps, to be performed at different stages. Tests were to be done as follows
Testing Criteria

White Box Testing 1. Transaction path Testing

In this phase each and every condition within a

unit program were tested. As and when loop or condition statements were incorporated into a unit the loops were tested for correctness, for foundry conditions and for not getting into infinite execution cycle. The data used was whatever necessary at that

instance. The path of each transaction from origin to destination was tested for reliable results.

2. Module Testing This was carried out during the programming

stage itself. Individual programs were tested at the time of coding and necessary changes are made there on to make sure that the modules in the form program, is working satisfactory as regards the expected output from the module. All aspects of the program viz. All choices available were properly tested. 3. String Testing

After loading all individual program string was

performed for each one of Programs where the output generated by one program is used as input by another program. This step was completed after making necessary changes wherever required.

Black Box Testing There are essentially two main approaches to designing black-box test cases:

Equivalence class partitioning: In this approach, the domain of input values to the program was partitioned into a set of equivalence classes. The partitioning was done such that the behavior of the program is similar for every input data belonging to the same equivalence class. The main idea behind defining the equivalence classes is that testing the code with anyone value belonging to that equivalence class. The general guidelines followed for designing the equivalence classes are: If the input data values can be specified by a

range of values, then one valid and two invalid equivalence classes should be defined. If the input can assume values from a set of

discrete members of some domain, then one equivalence class for valid Input values and another equivalence class for invalid input values should be defined.

making changes.
Test Review

Test review is the process that ensures that testing Is carried out as planned test review decides whether or not the program Is ready to ship out for the Implementation. For each data entry screen, we prepared test data with extreme values and under all relevant data- entry screen against real this process helped in rectifying the modules time.

Testing Procedure

Different type of checks like duplicate checks, completeness check, validity checks etc. are Incorporated In this system, as the data has to be entered In different cards. The user is not familiar with new system the data entry screens are designed in such a way that they are: Consistent Compatible Easy to use Had quick response

The following conventions are used while designing of the various screens to make the system user friendly All the items that are logically related Boundary value analysis: Some typical programming errors at the boundaries of different equivalence classes of Input. The primary reason for such errors Is the psychological factor. A common mistake by the programmers is In failing to Identify the special processing required by the Input values that lie at the boundary of the different equivalence classes. For example, an Improper use of < Instead of < =, or conversely. Boundary value analysis leads to the selection of test cases at the boundaries of the different equivalent classes.

System Testing

After module and string testing, the systems were

tested as a whole system Tests were undertaken to check bundled modules for errors. The errors found in the couple system as a whole was corrected. A testing on the Actual data of the company followed this. During this phase the existing System and this package was running in parallel to enable us to verify

and compare the result sets. The following criteria were to be used while testing the system.

Output Testing No systems could be useful if it does not produced

the required operation for that matter operation in the required format the outputs generated or displayed by the system under consider was tested by asking the format required by them.

User Acceptance Testing

User acceptance of a system is a key factor for the success of any system. The system under consideration was tested for user acceptance by constantly keeping in touch with the prospected system users at the time of developing and are together. For a particular card, query has been provided

Error and validation messages are provided

wherever required System testing is against its initial objectives, it is

done in a simulated environment. Testing techniques and testing strategies used Along with the test case Designs and test reports

Debugging and code improvement 1. System security measure (implementation of

security for the project developed) Database /data security

Software Engineering Paradigm Rapid Application Model (RAD) Model is used in this Project. RAD Model is the advance version of the Linear sequential Model and it continues with the high pace. This Model is applicable for the tight deadline and small team size. This Model lasts for 60 to 90 days. This model has five different phases, these phases are:

1.

Business Model:- In this Phase the complete All the

structure of the application is designed.

requirement of the client is completely analyzed and a common decision to the business problem is taken. This phase constraints on information gathering and convert it into the process model. 2. Data Model:- In this phase the information which

are gathered and its component is converted into well defined object i.e. this model constraints on Modularity Concept. 3. Process Model:processing, In process modeling complete Other information like structure are also team

flow design is designed. business considered.

4.

Application Model :Testing module

An testing

application starts in

generation the real coding start with some high level language. programmers side.

5.

Testing And Turnover :-

The

real

testing

start in this phase including the client side testing. The

implementation of the project is also takes place in this phase.

In this model customer doesnt have to explain the requirement again and again. We can use this model in a situation where there is no more skill is required. This model is very helpful to a tight schedule project.

COST AND BENEFIT ANALYSIS In developing cost estimate for a system, we need to consider several cost elements. Among them are hardware, personnel, facility, operating and supply cost. 1. Hardware costs relate to actual purchase or lease of the computers and peripherals (e.g. disk drive, printer, tape unit). Determining the actual cost of hardware is generally more difficult when the system is shared by various users than for a dedicated stand-alone system. In some cases, the best way to control for this cost is to treat it as an operating cost. 2. Personnel costs include EDP staff salaries and benefits (health insurance, vacation time, sick pay, etc.) as wen as pay for those involved in developing the system. Costs incurred during the development of a system are one-time cost and are labeled development costs. Once the system is installed, the costs of operating and maintaining the system become recurring cost. 3. Facility costs are expense incurred in the preparation of the physical site where the application or the computer will be in operation. This includes

wiring, flooring, acoustics, lighting, and air conditioning. These are treated as one-time costs and are incorporated into the overall cost estimate of the candidate system. 4. Operating costs include all costs associated with the day-to-day operation of the system; the amount depends on the number of shifts, the nature of the applications, and the caliber of the operating staff. There are various ways of covering operating costs as overheads. Another approach is to charge each authorized user for the amount of processing they request from the system. The amount charged is based on computer time, and volume of the output produced. In any case, some accounting is necessary to determine how operating costs should be handled. 1. Supply costs are variable costs that increase with

increased use of paper, ribbons, disks, and the like. They should be estimated and included in the overall cost of the system. A system is also expected to provide benefits. The first task is to identify each benefit and then assign a

monetary value to it for cost/benefit analysis. Benefits may be tangible and intangible, direct or indirect. The two major benefits are improving, performance and minimizing the cost of processing. The performance category emphasizes improvement in the accuracy of or access to information and easier access to the system by authorized users. Minimizing costs through an efficient system -error control or reduction of staff - is a benefit that should be measured and included in the cost and benefit analysis.

Procedure for Cost/Benefit Determination Building a computer-based system is an investment because here the investment is done to realize return on investment. The benefits are realized in the form of reduced operating costs, improved corporate image, staff efficiency, or revenues. The function of cost / benefit analysis is to analyze to what extent the benefits out weight the costs. The determination of cost and benefit entails the following steps:

Identifying the cost and benefits pertaining to a given project: certain costs and benefits are more easily identifiable than others. For example the cost of an hard disk are easily identifiable from the company invoice payments. Direct benefits relate one-to-one to direct cost, especially saving from reducing operation cost. E-Gov. saves the infrastructure cost, cost of getting the students and teacher together in one place at one time.

Categorize the various costs and benefits for analysis: the cost and benefits can be categorized as: Tangible or Intangible Costs and Benefits Direct and Indirect Costs and Benefits Fixed or Variable Costs and Benefits

Select a method of evaluation Once all financial data has been identified and broken down into cost categories, a method of evaluation had to be selected. There are several evaluation methods available, each with its pros and cons. Some of the common methods are:

Net benefit analysis Present value analysis Net present value Payback analysis Break-even analysis Cash flow analysis

Break-even analysis was chosen as the method of evaluation: Break-even is the point where the cost of the candidate system and that of the current one are equal. Unlike the payback method that compares costs and benefits of the candidate system, break-even compares the costs of the current and the candidate system. When a candidate system is developed the initial cost usually exceeds those of the current system. This is an Investment period. When both costs are equal, It is Break-even. Beyond that point, the candidate system provides greater benefit (profit) than the old one - a return period. 1. 2. Interpret the results of analysis Take action

Once the evaluation of the project is complete, actual results are compared against standard or alternative investments. The decision to adopt an alternative system can be highly subjective, depending on the user's confidence in the estimated cost n benefit values and the magnitude of Investment.

SELF-EXPERIENCE
It was very interesting to develop the project with great challenges & conditions. It was a wonderful experience to have been a part of a project that enhanced our skills & scope up our potentials. Having completed the project successfully we now free like an achievement that came up with great experience. With the help of this project we are able to know

more about the software which we used.

S-ar putea să vă placă și