0% found this document useful (0 votes)
167 views25 pages

ALIEN IT PROJECT - Edited - Edited

This document summarizes a student project on a City-State Information System. The project includes forms for login, registration, and a main menu. The main menu allows users to add new city records, display all city information, and remove data from the database tables. The project uses Java and MySQL to build a front-end interface and back-end database. It aims to help an institution easily manage and maintain records of cities and states.

Uploaded by

Robert Yurembam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views25 pages

ALIEN IT PROJECT - Edited - Edited

This document summarizes a student project on a City-State Information System. The project includes forms for login, registration, and a main menu. The main menu allows users to add new city records, display all city information, and remove data from the database tables. The project uses Java and MySQL to build a front-end interface and back-end database. It aims to help an institution easily manage and maintain records of cities and states.

Uploaded by

Robert Yurembam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

JAWAHAR NAVODAYA VIDYALAYA

BISHNUPUR,MANIPUR

PROJECT ON INFORMATION
TECHNOLOGY

Submitteb to the Department of Computer Sience,

JNV Bishnupur,for partial fulfillment of


information Tecnology Practial
Examination,AISSCE-2022-23

SUBMITTED TO: SUBMITTED BY


RESPECTED , ROHIT OINAM
K.KUBER SINGH XII SCIENCE
PGT COMPUTER SCIENCE ROLLNO:
ROLL NO:38
38
CERTIFICATE

This is to certify that Shri/Kum Rohit


Oinam have successfully completed
the project CITY STATE INFORMATION SYSTEM
under my guidance and supervision
for partial fulfillment of AISSCE
Information Technology
Examination 2023

Guided by : Countersigned by
K. Kuber Singh Principal
PGT Computer Science JNV Bishnupur
JNV Bishnupur
Contents
1 Acknowledgement 1

2 Introduction 2

3 Login Form 3

4 Registration form 4

5 Main Menu 5

6 Add New Record 6

7 Display all Information 7

8 Data Base Design 8

9 Remove Data from Table 9

10 Conclusion 10
Acknowledgement
First we would like to express our special thanks of
gratitude to our principal as well as to our teacher Sir K.
Kuber Singh, PGT Computer Science who give us golden
opportunity to do this Project “STATE CITY INFORMATION
SYSTEM” which help us a lot in doing this project. We are
really thankful to them.

Secondly, we would like to thank to all those who


helped us to complete this project in time.
INTRODUCTION
The project City State Information System is done for the partial
fulfillment of Information Technology Practical Examination 2012-23. This
project provide the facilities in which an institution can administer and
maintain the record of City – State.

Here the authenticate user provide different forms :

1. Login form
2. To create new ID.
3. Main menu of the project
a. To add new city
b. To display all data
c. To delete record.

The user is free to use the above mentioned forms and access data
according to his/her convenient. Adding new record of City accordingly
display all the information of city and delete data from City-State record
can be done very easily.

To complete this project we use the two main things :

1. Front End : it is developed by using JAVA NET BEANS.


2. Back End : It is developed by using MySQL.
LOGIN FORM

In the above login page there is one textfield (tf1) in which the user
should write their respected if and there is also a password field(p1) to write
their password. After completing, the user should click OK which brings the
user to the next page and if the user wants to clear the written id and
password he/she should press Reset. If the account is not registered the user
should click new user.

CODE FOR OK BUTTON :


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import javax.swing.JOptionPane;
import java.sql.ResultSet;

public class loginframe extends javax.swing.JFrame


{
public loginframe()
{
initComponents();
}
private void okbtActionPerformed(java.awt.event.ActionEvent evt)
{
// TODO add your handling code here:

Try
{
Strings = uidtf.getText();
String pwd = new String(pf.getPassword());
Class.forName("java.sql.Driver");

Connection con;
con = DriverManager.getConnection ("jdbc:mysql://localhost/
jnvbpr","root","kvuc");
Statement stmt;
stmt = con.createStatement();
ResultSet rs;
rs= stmt.executeQuery("SELECT * FROM USERID WHERE USER_ID=
'"+uidtf.getText()+"';");

String s1;

//int n1=pdt.executeUpdate();
if( rs.next())
{
if(pwd.equals(rs.getString("password")))
{
this.setVisible(false);
new main_menu().setVisible(true);
}
else
{
JOptionPane.showMessageDialog(null,"Password Miismatch
Try
again");
pf.setText("");
}
//ResultSet rs;
// stmt.executeUpdate(query);
// rs = stmt.executeUpdate(query);

// rs.close();
stmt.close();
con.close();

}
else
JOptionPane.showMessageDialog(null," User name Not found");

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Error occured");
// TODO add your handling code here:
}
}

// Code for Create New Button ******************************

private void createnewbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
this.setVisible(false);
new reg().setVisible(true);
}

// Code for EXIT Button ******************************

private void exitbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
System.exit(0);
}

public static void main(String args[]) {


/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run()
{
new loginframe().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton createnewbt;
private javax.swing.JButton exitbt;
private javax.swing.JLabel jLabel1;
private javax.swing.JButton okbt;
private javax.swing.JPasswordField pf;
private javax.swing.JLabel pwdlabel;
private javax.swing.JLabel uidlabel;
private javax.swing.JTextField uidtf;
// End of variables declaration
}
REGISTRATION FORM

CODE FOR REGISTER BUTTON :

import java.sql.*;
import javax.swing.JOptionPane;

public class reg extends javax.swing.JFrame


{
public reg()
{
initComponents();
}
private void rgbtActionPerformed(java.awt.event.ActionEvent evt)
{
// TODO add your handling code here:

String un = untf.getText();
String p1 = new String(pf1.getPassword());
String p2 = new String(pf2.getPassword());
if(p1.equals(p2))
{
Try
{
Class.forName("java.sql.Driver");
Connection con;
con =
DriverManager.getConnection("jdbc:mysql://localhost/jnvbpr","root
","kvuc");
Statement stmt;
stmt = con.createStatement();
stmt.executeUpdate("INSERT INTO USERID VALUES( "+" "+"'"
+un+"'"+","+" "+"'" +p1+"'"+");");
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Error occured");
// TODO add your handling code here:
}
}
else
JOptionPane.showMessageDialog(null, "Password Mismatch ");

// ******** CODE FOR BACK BUTTON *****************

private void backbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
this.setVisible(false);
new loginframe().setVisible(true);
}

// ******** CODE FOR EXIT BUTTON *****************

private void exitbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
System.exit(0);
}

/**
* @param args the command line arguments
*/
public static void main(String args[])
{
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{
new reg().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton backbt;
private javax.swing.JButton exitbt;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPasswordField pf1;
private javax.swing.JPasswordField pf2;
private javax.swing.JButton rgbt;
private javax.swing.JTextField untf;
// End of variables declaration
}
MAIN MENU OF CITY –STATE INFORMATION

In the above interface there are three radio buttons namely add new
city(rb1), display(rb2), remove(rb3). Moreover there are three buttons OK,
CANCEL and EXIT.

Code for OK button :


public class main_menu extends javax.swing.JFrame
{

/**
* Creates new form main_menu
*/
public main_menu()
{
initComponents();
}
private void okbt2ActionPerformed(java.awt.event.ActionEvent evt)
{
// TODO add your handling code here:
if(rbadd.isSelected())
{
new Add().setVisible(true);
this.setVisible(false);
}
if(rbdis.isSelected())
{
new Display().setVisible(true);
this.setVisible(false);
}
if(rbrev.isSelected())

{
new remove().setVisible(true);
this.setVisible(false);
}
}

//************ CODE FOR CANCEL BUTTON *******************

private void cancelbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
rbadd.setSelected(false);
rbdis.setSelected(false);
rbrev.setSelected(false);
}

//************ CODE FOR EXIT BUTTON *******************

private void exitbt2ActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
System.exit(0);

/**
* @param args the command line arguments
*/
public static void main(String args[])
{
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{
new main_menu().setVisible(true);
}
});
}

}
ADD NEW CITY FORM

CODE FOR SUBMIT BUTON :


import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Student
*/
public class Add extends javax.swing.JFrame
{

/**
* Creates new form Add
*/
public Add()
{
initComponents();
}
private void submitbtActionPerformed(java.awt.event.ActionEvent evt)
{
// TODO add your handling code here:

Try
{
Class.forName("java.sql.Driver");

Connection con;
con =
DriverManager.getConnection("jdbc:mysql://localhost/jnvbpr","root","kvuc
");
Statement stmt;
stmt = con.createStatement();
stmt.executeUpdate("INSERT INTO CITY VALUES("+"'" + stf.getText() + "'"+",
"+"
"+"'" +ctf.getText() +"'"+", "+" '" +ptf.getText()+"', "+" "+ltf.getText()+");");

stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Error occured");
// TODO add your handling code here:
}
}

// *************** CODE FOR RESET BUTTON **********************

private void resetbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
ctf.setText(" ");
ptf.setText(" ");
ltf.setText(" ");
}

// *************** CODE FOR RESET BUTTON **********************

private void backbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
this.setVisible(false);
new main_menu().setVisible(true);
}

/**
* @param args the command line arguments
*/
public static void main(String args[])
{
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{
new Add().setVisible(true);
}
});
}

}
DISPLAY RECORD FRAME

Code for OK button :


import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

public class Display extends javax.swing.JFrame


{
public Display()
{
initComponents();
}
private void rtrBtnActionPerformed(java.awt.event.ActionEvent evt)
{

DefaultTableModel model;
model = (DefaultTableModel)depTbl.getModel();
try
{
Class.forName("java.sql.Driver");

Connection con;
con =
DriverManager.getConnection("jdbc:mysql://localhost/jnvbpr","root","kvuc
");
Statement stmt;
stmt = con.createStatement();
String query = "SELECT * FROM CITY ORDER BY STATE;";
ResultSet rs;
rs = stmt.executeQuery(query);
while(rs.next())
{
String cn = rs.getString("City_name");
Stringsn = rs.getString("State");
String p = rs.getString("Population");
String l = rs.getString("Literacy");

model.addRow(new Object[] {sn, cn, p, l});


}
rs.close();
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Error occured");
// TODO add your handling code here:
}
}

Code for BACK Button :

private void backbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
this.setVisible(false);
new main_menu().setVisible(true);
}

/**
*
* @param args
*/
public static void main(String args[])
{
/* Set the Nimbus look and feel */
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{

new Display().setVisible(true);
}
});
}

}
REMOVE DATA FROM TABLE

In the above interface the user can remove data from table.

Code for delete button :


import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

public class remove extends javax.swing.JFrame


{
public remove()
{
initComponents();
}

//******** CODE FOR DELETE BUTTON **************

private void delbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
DefaultTableModel model;
int res=JOptionPane.showConfirmDialog(null, "Do you really want to delete this
reoord");
if(res==JOptionPane.YES_OPTION)
{
Try
{
Class.forName("java.sql.Driver");

Connection con;
con =
DriverManager.getConnection("jdbc:mysql://localhost/jnvbpr","root
","kvuc");
Statement stmt;
stmt = con.createStatement();
String query = "DELETE FROM CITY WHERE CITY_NAME='"
+cnametf.getText()+"';";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "Record deleted");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Error in Deletion");
}

}
cnametf.setText("");
stf.setText("");
ptf.setText("");
ltf.setText("");
delbt.setEnabled(false);

//******** CODE FOR LOAD BUTTON **************

private void ldabtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
Try
{
Class.forName("java.sql.Driver");

Connection con;
con =
DriverManager.getConnection("jdbc:mysql://localhost/jnvbpr","root","kvuc
");
Statement stmt;
stmt = con.createStatement();
String query = "SELECT * FROM CITY WHERE CITY_NAME='"
+cnametf.getText()+"';";
ResultSet rs;
rs = stmt.executeQuery(query);
if(rs.next())
{
String cn=rs.getString("City_name");
Stringsn=rs.getString("State");
String p=rs.getString("Population");
String l=rs.getString("Literacy");
cnametf.setText(cn);
stf.setText(sn);
ptf.setText(p);
ltf.setText(l);

delbt.setEnabled(true);
}
else
{
JOptionPane.showMessageDialog(null, "No such Reocrd Found");
}
rs.close();
stmt.close();
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Error occured");
// TODO add your handling code here:
}
}

//******** CODE FOR CANCEL BUTTON **************

private void cancelbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
cnametf.setText("");
stf.setText("");
ptf.setText("");
}

//******** CODE FOR BACK BUTTON **************

private void backbtActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
this.setVisible(false);
new main_menu().setVisible(true);
}

private void ptfActionPerformed(java.awt.event.ActionEvent evt)


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

private void ltfActionPerformed(java.awt.event.ActionEvent evt)


{
// TODO add your handling code here:
}

/**
* @param args the command line arguments
*/
public static void main(String args[])
{
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{
new remove().setVisible(true);
}
});
}

}
DATABASE DESIGN:

DATABASE NAME LIBRARY :

TALBES :
1. USER ID.

FIELD NAME DATA TYPE CONSTRAINT


USER_ID VARCHAR(10) PRIMARY KEY
PASSWORD CHAR(10) …………………

2. CITY

FIELD NAME DATA TYPE CONSTRAINT


CITY_NAME VARCHAR(10) PRIMARY KEY
POPULATION CHAR(100
LITERACY_RATE DECIMAL(5,2)
STATE VARCHAR(15)
CONCLUSION
The Information Technology project had really make us increase our
knowledge about java programming. This project also helps us in
understanding the details of our lesion.

In order to complete the project in a very systematic way we have faced


some problems like making the interface.

We have also gain lots of information and knowledge about java


programming. We also wish and request our respected Sir K. Kuber Singh to
give this kind of project incoming class 12 students in future.

Lastly we would like to thank all those people who have helped us.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy