aptech computer education

93
Chapter 1 ORGANIZATION OVERVIEW “Aptech Computer Education is a premier IT education Institute. Established in 1986, Aptech is a pioneer in IT software & hardware training.” OVERVIEW Aptech Computer Education is a premier ITeducation Institute. Established in 1986, Aptech is apioneer in IT software & hardware training. The Institute has successfully trained more than 65lakh (6.5 million) students through its wide network of education centres located in over 40 countries. The Academy offers: World class quality of education A wide range of courses Benefits through alliances with international companies like Microsoft, Red Hat & Oracle Job placement assistance after successful completion of career courses . According to a NASSCOM* report, the Indian IT- BPO 1

Upload: sai-printers

Post on 28-Dec-2015

41 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Aptech Computer Education

Chapter 1

ORGANIZATION OVERVIEW

“Aptech Computer Education is a premier IT

education Institute. Established in 1986, Aptech is a

pioneer in IT software & hardware training.”

OVERVIEW

Aptech Computer Education is a premier ITeducation Institute. Established in 1986, Aptech is

apioneer in IT software & hardware training. The Institute has successfully trained more than

65lakh (6.5 million) students through its wide network

of education centres located in over 40 countries.

The Academy offers:

World class quality of education A wide range of courses Benefits

through alliances with international companies like Microsoft, Red Hat & Oracle Job

placement assistance after successful completion of career courses . According to a

NASSCOM* report, the Indian IT- BPO industry is expected to grow at a rate of 12-

15% this year. The industry is predicted to cross revenues of USD 100 billion during

2012-13, thus creating a demand for 28 lakh qualified IT professionals.

Aptech Computer Education prepares students to be a part of this growing industry.

Quality education:1

Page 2: Aptech Computer Education

Aptech gives great importance to providing high-quality education to students. By

joining an IT career course with Aptech, you get:

A wide variety of career, professional,

short-term & certification courses

designed for the learning & career

needs of students, working

professionals & others

Alliances with industry leaders like

Java, Oracle, Microsoft & Red Hat

which helps students obtain global

certifications

Workshops, Events & other activities to

encourage student-industry interaction,

prepare them for their job interviews &

make them industry-ready

Business Partners:

Technology has influenced every part of our

life & IT skills are a must for every company

today. Therefore, IT training & education has

great business potential & starting your own

training institute is a profitable & secure

business opportunity.

Aptech's reputation as a leader in IT training over the past

26 years & a wide network of centers all over India make it

a sound investment for starting your own business. Aptech Ltd is the pioneer in IT

education franchising with many industry awards for its expertise & experience in the

Franchisee business model.

2

Page 3: Aptech Computer Education

Aptech Ltd boasts of over 20 years of experience in training students in various sectors

like animation, hardware & networking all over the world.

Course offered by aptech:

Professional courses

Smart Professional- Java

Smart Professional- .NET

Smart Professional- MIS

IT Booster - .NET

IT Booster – Java

Aptech Certified Web Designer (ACWD)

Smart Accountant

Certification Courses

Microsoft .NET

Red Hat Certification

Oracle

Java

Short-term courses

Cloud Computing

C in practice – Examinable

Programming Languages

Database

Foundation Courses

3

Page 4: Aptech Computer Education

Chapter 2

INTRODUCTION TO PROJECT

The project ”web based library” has many features of saving records of new books,

magazines. And view them. This project reduces the manual work to much extent and

stores the data and retrieves the data for further use. This project really helps the user

and saves his/ her time and increase efficiency. With the development of this software

the organization would get faster up gradation of records of the books & magazines

and would retrieve faster than manual system.This Library Management Project is best

suited to manage a Library. It can retain records for future references. User can view

the old records as well as current records. This project has very much capacity to

retaining records. It can be accessed or manipulate according to our need. Records can

be retained for future use.This project can be further upgraded to handle other

operation,if introduced in future,in library center

Project Inititation Note4

Page 5: Aptech Computer Education

Client : Aptech Computer Education

Project Name : Web Based Library

Duration : 6 Weeks

Quality Reviewer: Mr. Prashant Kumar

Internal Auditor : Mr. Akhilesh Kumar

Team Members : Abhishek Kr. Bharati

Indrajeet Kumar

Initiated by : Mr. Akhilesh Kumar

Date: 12 July 2012

Tool and Platform5

Page 6: Aptech Computer Education

Operating System

Windows XP SP2

Front End

JAVA

Back End

SQL Server2000

Hardware Requirements:

Pentium IV Processor

512 MB RAM

80 GB Hard Disk

Software Requirements:

jdk1.5.0

Internet Explorer 8

SQL Server2000

Ms-office

Chapter 36

Page 7: Aptech Computer Education

INTRODUCTION TO JAVA

Java is a programming language originally developed by James Gosling at Sun

Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995

as a core component of Sun Microsystems' Java platform. The language derives much

of its syntax from C and C++ but has a simpler object model and fewer low-level

facilities. Java applications are typically compiled to bytecode (class file) that can run

on any Java Virtual Machine (JVM) regardless of computer architecture. Java is a

general-purpose, concurrent, class-based, object-oriented language that is specifically

designed to have as few implementation dependencies as possible. It is intended to let

application developers "write once, run anywhere". Java is currently one of the most

popular programming languages in use, and is widely used from application software

to web applications.

The original and reference implementation Java compilers, virtual machines, and class

libraries were developed by Sun from 1995. As of May 2007, in compliance with the

specifications of the Java Community Process, Sun relicensed most of its Java

technologies under the GNU General Public License. Others have also developed

alternative implementations of these Sun technologies, such as the GNU Compiler for

Java and GNU Classpath.

Java Technology

Java Technology

Java Enterprise Edition (Java EE)

Java Mobile Edition ( Java ME)

Versions

7

Page 8: Aptech Computer Education

1. Product Version

a. 1.0

b. 1.1

c. 1.2

d. 1.3

e. 1.4

f. 5.0

g.6.0

2. Developer Version (JDK & JRE)

a. 1.0

b. 1.1

c. 1.2

d. 1.3

e. 1.4

f. 1.5

g. 1.6

Tools

1. Java Development Kit (1.5 & 1.6)

2. Java Runtime Environment (1.5 & 1.6) 8

Page 9: Aptech Computer Education

Editor or IDE

1. Notepad

2. Kawa

3. Net Beans

4. Eclipse

5. IntelliJ

6. IBM Visual Age

7. Oracle JDeveloper

Etc.

JDK Javac.exe, JAVAP.EXE, JAR.EXE etc.

JRE Java Virtual Machine + Garbage Collector

JVM Code Verifier + JIT (Just-In-Time) compiler

HISTORY OF JAVA

James Gosling and Patrick Naughton initiated the Java language project in June 1991 for use

in one of his many set-top box projects. Java was originally designed for interactive

television, but it was too advanced. The language was initially called Oak after an oak tree

9

Page 10: Aptech Computer Education

that stood outside Gosling's office; it went by the name Green later, and was later renamed

Java, from a list of random words. Gosling aimed to implement a virtual machine and a

language that had a familiar C/C++ style of notation.

Sun Microsystems released the first public implementation as Java 1.0 in 1995. It promised

"Write Once, Run Anywhere " (WORA), providing no-cost run-times on popular platforms.

Fairly secure and featuring configurable security, it allowed network- and file-access

restrictions. Major web browsers soon incorporated the ability to run Java applets within web

pages, and Java quickly became popular. With the advent of Java 2 (released initially as J2SE

1.2 in December 1998–1999), new versions had multiple configurations built for different

types of platforms. For example, J2EE targeted enterprise applications and the greatly

stripped-down version J2ME for mobile applications (Mobile Java). J2SE designated the

Standard Edition. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE,

Java ME, and Java SE, respectively.

In 1997, Sun Microsystems approached the ISO/IEC JTC1 standards body and later the Ecma

International to formalize Java, but it soon withdrew from the process. Java remains a de facto

standard, controlled through the Java Community Process. At one time, Sun made most of its

Java implementations available without charge, despite their proprietary software status. Sun

generated revenue from Java through the selling of licenses for specialized products such as

the Java Enterprise System. Sun distinguishes between its Software Development Kit (SDK)

and Runtime Environment (JRE) (a subset of the SDK); the primary distinction involves the

JRE's lack of the compiler, utility programs, and header files.

On November 13, 2006, Sun released much of Java as open source software under the terms

of the GNU General Public License (GPL). On May 8, 2007, Sun finished the process,

making all of Java's core code available under free software/open-source distribution terms,

aside from a small portion of code to which Sun did not hold the copyright.

Sun's vice-president Rich Green has said that Sun's ideal role with regards to Java is as an

"evangelist.

Chapter 4

INTRODUCTION TO JDBC

10

Page 11: Aptech Computer Education

JDBC provides a standard library for

accessing relational databases

– API standardizes

• Way to establish connection to database

• Approach to initiating queries

• Method to create stored (parameterized) queries

• The data structure of query result (table)

– Determining the number of columns

– Looking up metadata, etc.

– API does not standardize SQL syntax

• JDBC is not embedded SQL

– JDBC classes are in the java.sql package

Basic Steps inUsing JDBC

1. Load the driver

– Not required in Java 6, so Java 6 needs only 6 steps.

2. Define the Connection URL

3. Establish the Connection

4. Create a Statement object

5. Execute a query

6. Process the results

7. Close the connection

JDBC Step 1: Load the Driver

• Not required in Java 6

– In Java SE 6.0 and later (JDBC 4.0 and later), the driver

is loaded automatically.

• Java 5 and earlier

– Load the driver class only. The class has a static

initialization block that makes an instance and registers it

with the DriverManager.

try {

Class.forName("com.mysql.jdbc.Driver");

Class.forName("oracle.jdbc.driver.OracleDriver");

11

Page 12: Aptech Computer Education

} catch (ClassNotFoundException cnfe) {

System.out.println("Error loading driver: " cnfe);

}

14

JDBC Step 2: Define the

Connection URL

• Remote databases

– Format is “jdbc:vendorName:…”

• Address contains hostname, port, and database name

• Exact details given by supplier of JDBC driver

• Embedded Derby database

– The “Java DB” (i.e., Apache Derby) is bundled with Java 6

and can be used for a database embedded in the same Java VM

that runs the app server.

– Format is “jdbc:derby:databaseName”

• Examples

String host = "dbhost.yourcompany.com";

String dbName = "someName";

int port = 1234;

String mySqlUrl = "jdbc:mysql//" + host + ":" + port +

"/" + dbName;

String embeddedDerbyUrl = "jdbc:derby" + dbName;

15

JDBC Step 3: Establish the

Connection

• Get the main connection

Properties userInfo = new Properties();

userInfo.put("user", "jay_debesee");

userInfo.put("password", "secret");

Connection connection =

DriverManager.getConnection(mySqlUrl, userInfo);

• Optionally, look up info about the database

DatabaseMetaData dbMetaData =

connection.getMetaData();

String productName =

12

Page 13: Aptech Computer Education

dbMetaData.getDatabaseProductName();

System.out.println("Database: " + productName);

String productVersion =

dbMetaData.getDatabaseProductVersion();

System.out.println("Version: " + productVersion);

16

JDBC Step 4: Make a Statement

• Idea

– A Statement is used to send queries or commands

• Statement types

– Statement, PreparedStatement, CallableStatement

• Details on other types given later

• Example

Statement statement =

connection.createStatement();

17

JDBC Step 5: Execute a Query

• Idea

– statement.executeQuery("SELECT … FROM …");

• This version returns a ResultSet

– statement.executeUpdate("UPDATE …");

– statement.executeUpdate("INSERT …");

– statement.executeUpdate("DELETE…");

– statement.execute("CREATE TABLE…");

– statement.execute("DROP TABLE …");

• Example

String query =

"SELECT col1, col2, col3 FROM sometable";

ResultSet resultSet =

statement.executeQuery(query);

18

JDBC Step 6: Process the

Result

• Important ResultSet methods

– resultSet.next()

• Goes to the next row. Returns false if no next row.

13

Page 14: Aptech Computer Education

– resultSet.getString("columnName")

• Returns value of column with designated name in current

row, as a String. Also getInt, getDouble, getBlob, etc.

– resultSet.getString(columnIndex)

• Returns value of designated column. First index is 1 (ala

SQL), not 0 (ala Java).

– resultSet.beforeFirst()

• Moves cursor before first row, as it was initially. Also first

– resultSet.absolute(rowNum)

• Moves cursor to given row (starting with 1). Also last and

afterLast.

19

JDBC Step 6: Process the

Result

• Assumption

– Query was “SELECT first, last, address FROM…”

• Using column names

while(resultSet.next()) {

System.out.printf(

"First name: %s, last name: %s, address: %s%n",

resultSet.getString("first"),

resultSet.getString("last"),

resultSet.getString("address"));

}

• Using column indices

while(resultSet.next()) {

System.out.printf(

"First name: %s, last name: %s, address: %s%n",

resultSet.getString(1),

resultSet.getString(2),

20 resultSet.getString(3)); }

JDBC Step 7: Close the

Connection

• Idea

– When totally done, close the database connection.

However, opening a new connection is typically much

14

Page 15: Aptech Computer Education

more expensive than sending queries on existing

connections, so postpone this step as long as possible.

– Many JDBC drivers do automatic connection pooling

– There are also many explicit connection pool utilities

• Example

connection.close();

Software requirement analysis

15

Page 16: Aptech Computer Education

2jdk1.5.0

Notepad & Net beans 6.5.1

Internet Explorer 8

SQL Server2000

Ms-office

Operating system(window 7/window vista)

Chapter 5

DATA FLOW DIAGRAM

16

Page 17: Aptech Computer Education

user Authenti-cation User list

Unit Of Operation

Login Data User Data

The DFD is an excellent communication tool for analysts to model processes and functional

requirements. Used effectively, it is a useful and easy to understand modeling tool. It has

broad application and usability across most software development projects.

The data flow diagram shows how data flows form one point to another point in the

current physical system. The processes through which the transformation of the data takes

place normally create the data and used it. The four basic symbols are used to construct the

data flow diagram. These are the symbols which represents data source, data flow, data

transformation, and data storage. The point at which data transformed are represented by

enclosed figure, usually circles, which are called nodes.

Level-0

Level-1.1

17

Page 18: Aptech Computer Education

Member Member Entry Member ListMember Detail

StockStock Entry

Stock DetailsBook Return

Book Detail

Level-1.2

Level-1.3

18

Page 19: Aptech Computer Education

Issue BookBook code

Book DetailsMember Id

Member Id

Return BookBook code

Book DetailsMember Id

Member Id

Level-1.4

E-R DIAGRAM

19

Page 20: Aptech Computer Education

Web Based Library

Login

UserAdmin

View Stock View Defaulter list

Create Member

Address

Email ID

Mo. No.

PasswordName

Create Member Stock EntryIssue Book Return Book

NameAddress

M-ID

PasswordMob-No.

Email ID

Book Code

Name Of Book

No Of Book

Category

Publication

Move To Next Page

20

Page 21: Aptech Computer Education

Issue Book Return Book

Book Code

Issue Date

Member ID

Schedule Return Date

Member Id

Book Code

Actual Return Date

Schedule Return Date

Fine

21

Page 22: Aptech Computer Education

DATA STRUCTURES

Table: Authentication

Field

Name

Data

Type

Size

U_Name Varchar2 15

Pwd Varchar2 10

Table: Member

Field

Name

Data

Type

Size

Name Varchar 20

Address Varchar 30

M_ID Varchar 10

Password varchar 20

Email_Id Varchar 30

Mob_No

.

Int

Table: Stock:-

Field Name Data

Type

Size

B_Code Varcha

r

20

22

Page 23: Aptech Computer Education

Name

_of_Book

Char 20

Caregory Varcha

r

20

Publication Varcha

r

20

No_of_Book Int

Table: Issue_Book

Field Name Data

Type

Size

Book_Code Varchar 10

Member ID Varchar 30

Issue Date Date

ScheduleReturnDat

e

Date

Table: ReturnBook

Field Name Data

Type

Size

B_Code Varchar 20

M_ID Varchar 20

ScheduleReturnDate Date

ActualReturnDate Date

23

Page 24: Aptech Computer Education

Fine Int

MODULE DESCRIPTION

There are various Modules in the project:-

Authentication:-

This module is gives the permission to user to use the library because it holds

user Id & also hold the admin Id and Password.

Member:-

` This module store the many types of user Id and User details.

Stock:-

This module stores the book details which are available or not.

Issue Book:-

This module maintain the records of books which is issue to users.

Return Book:-

This module manage the returnig date of book and also calculate the fine

which is generated by delay time of returning date.

24

Page 25: Aptech Computer Education

COST ESTIMATION OF THE PROJECT

In case of this software, it is a live project for the submission of BSC(IT) paper.

Hence, this software is of cost free. But as far as the cost estimation is concerned, it is a

technique by which a S/W Development company can prepare Cost Analysis Report. This

will help the company to prepare product price including their profit.

PERT CHART

Some of the advantages of pert chart

It forces the manager to plan.

It shows the interrelationships among the task in the project.

It clearly identifies critical path of the project.

It exposes all possible parallelism in the activities and thus helps in allocating resources.

It allows scheduling and simulation of alternative schedules.

It enables the manager to monitor and control the project.

0 beginning

Prototype

2

2

1 Beginning

Of Needs

3 5

2

Problem 13 Final Documentation

Understanding User Acceptance Testing

6 92

2 7

25

Page 26: Aptech Computer Education

3

Problem Listing

12 Unit Testing

8

2 9 10 86 14 User Testing

Problem

4 Interviewing

11 Coding

3 12 40 76

5 Evaluation of 15 Installation

Existing system

3 15 Analysis of

Alternate candidate Detail Design

6 10 Specification 16

8 36

Details execution Delivery

3 18 of Project

7 9 General

Specification

6 28

4 8 22 Data collection

26

Page 27: Aptech Computer Education

GANTT CHART

Gantt charts (developed by Henry L. Gantt) are a project control technique that can be used

for several purposes including scheduling, budgeting and resource planning. A Gantt chart is a

bar chart with each bar representing an activity.

The bars are drawn against a time line. The length of each bar is proportional to the

length of time planned for the activity. Gantt chart can take different phase depending on their

intended use. The Gantt chart of WEB BASED LIBRARY is drawn for the time management.

Gantt chart is drawn below.

Gantt Chart for Web Based Library

27

Page 28: Aptech Computer Education

YEAR 2010

16Dec24Dec

Start

Analysis

Design Database (Back End)

Design of LMS diffenent form (Front End) Part

Code Part of LMS

Report Generation

Write Manual

Integration & Testing

Finish

Code data base part

28

Page 29: Aptech Computer Education

Chapter 6

Project Legacy

FUTURE SCOPE

This application can be easily implemented under various situations. We can add new features

as and when we require. Reusability is possible as and when require in this application. There

is flexibility in all the modules.

Reusability is possible as and when require in this application. We can update it next

version. Reusable software reduces design, coding and testing cost by amortizing effort over

several designs. Reducing the amount of code also simplifies understanding, which increases

the likelihood that the code is correct. We follow up both types of reusability: Sharing of

newly written code within a project and reuse of previously written code on new projects.

The different areas where we can use this application are:

Any educational institute can make use of it for providing information about author content of

the available books.

It can be used in offices and modifications can be easily done according to requirements.

29

Page 30: Aptech Computer Education

It also saves our time in this chalanging world. Because it runs on the Web browser and

connect to many peoples through internet who interested in web based library.

It will be the simpler way to access libraries.

Chapter 7

Source code

Html:-

Library.Html:-

<html>

<applet code="Library" width=300 height=300></applet>

<body bgcolor="skyblue">

</body>

</html>

JAVA:-

Authentication_:-

import java.sql.*;

import javax.swing.*;

import java.awt.*;

30

Page 31: Aptech Computer Education

import java.awt.event.*;

public class Authentication extends JFrame implements ActionListener

{

JLabel l1,l2;

JTextField t1;

JPasswordField t2;

JButton b1;

JPanel p;

GridBagLayout gb;

GridBagConstraints gc;

Authentication()

{

super("Authentication Window");

gb=new GridBagLayout();

gc=new GridBagConstraints();

p=new JPanel();

l1=new JLabel("ID");

l2=new JLabel("Password");

t1=new JTextField(10);

t2=new JPasswordField(10);

t1.setText("user");

t2.setText("user123");

b1=new JButton("Login");

getContentPane().add(p);

p.setLayout(gb);31

Page 32: Aptech Computer Education

gc.anchor=GridBagConstraints.CENTER;

gc.fill=GridBagConstraints.NONE;

gc.gridx=5;

gc.gridy=5;

gb.setConstraints(l1,gc);

p.add(l1);

gc.gridx=6;

gc.gridy=5;

gb.setConstraints(t1,gc);

p.add(t1);

gc.gridx=5;

gc.gridy=6;

gb.setConstraints(l2,gc);

p.add(l2);

gc.gridx=6;

gc.gridy=6;

gb.setConstraints(t2,gc);

p.add(t2);

gc.gridx=6;

gc.gridy=7;

gb.setConstraints(b1,gc);32

Page 33: Aptech Computer Education

p.add(b1);

b1.addActionListener(this);

setSize(200,150);

setVisible(true);

}

public void actionPerformed(ActionEvent e)

{

String strId="";

if(e.getSource()==b1)

{

try

{

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

Connection con=DriverManager.getConnection("jdbc:odbc:mydata","sa","");

PreparedStatement pstat=con.prepareStatement("select * from users where uid=? and

pwd=?");

pstat.setString(1,t1.getText());

pstat.setString(2,t2.getText());

ResultSet res=pstat.executeQuery();

while(res.next())

{

strId=res.getString(1);

}

if(strId.equals("admin"))

{

33

Page 34: Aptech Computer Education

AdminOptions opt=new AdminOptions();

}

if(strId.equals("user"))

{

UserOptions opt=new UserOptions();

}

}

catch(Exception ee)

{

System.out.println(ee);

}

}

}

public static void main(String args[])

{

Authentication au=new Authentication();

}

}

34

Page 35: Aptech Computer Education

AdminOption.java:-

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class AdminOptions extends JFrame implements ActionListener

{

JButton b1,b2,b3,b4,b5,b6;

JPanel p;

GridBagLayout gb;

GridBagConstraints gc;

AdminOptions()

{

super("Admin Options");

p=new JPanel();35

Page 36: Aptech Computer Education

gb=new GridBagLayout();

gc=new GridBagConstraints();

Font f=new Font("Arial",Font.BOLD+Font.ITALIC,25);

b1=new JButton("Create Member");

b2=new JButton("Stock Entry");

b3=new JButton("Issue Book");

b4=new JButton("Return Book");

b5=new JButton("View DefaulterList");

b6=new JButton("View Stock");

getContentPane().add(p);

p.setLayout(gb);

gc.anchor=GridBagConstraints.CENTER;

gc.fill=GridBagConstraints.NONE;

gc.gridx=5;

gc.gridy=5;

gb.setConstraints(b1,gc);

p.add(b1);

gc.gridx=5;

gc.gridy=6;

gb.setConstraints(b2,gc);

p.add(b2);

gc.gridx=5;

gc.gridy=7;36

Page 37: Aptech Computer Education

gb.setConstraints(b3,gc);

p.add(b3);

gc.gridx=5;

gc.gridy=8;

gb.setConstraints(b4,gc);

p.add(b4);

gc.gridx=5;

gc.gridy=9;

gb.setConstraints(b5,gc);

p.add(b5);

gc.gridx=5;

gc.gridy=10;

gb.setConstraints(b6,gc);

p.add(b6);

p.setBackground(Color.black);

b1.setBackground(Color.pink);

b2.setBackground(Color.pink);

b3.setBackground(Color.pink);

b4.setBackground(Color.pink);

b5.setBackground(Color.pink);

b6.setBackground(Color.pink);

b1.setFont(f);37

Page 38: Aptech Computer Education

b2.setFont(f);

b3.setFont(f);

b4.setFont(f);

b5.setFont(f);

b6.setFont(f);

b1.setForeground(Color.red);

b2.setForeground(Color.red);

b3.setForeground(Color.red);

b4.setForeground(Color.red);

b5.setForeground(Color.red);

b6.setForeground(Color.red);

b1.addActionListener(this);

b2.addActionListener(this);

b3.addActionListener(this);

b4.addActionListener(this);

b5.addActionListener(this);

b6.addActionListener(this);

setSize(200,200);

setVisible(true);

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==b1)

{38

Page 39: Aptech Computer Education

Member m=new Member();

}

if(e.getSource()==b2)

{

Stock s=new Stock();

}

if(e.getSource()==b3)

{

IssueBook bk=new IssueBook();

}

if(e.getSource()==b4)

{

ReturnBook bk=new ReturnBook();

}

}

public static void main(String args[])

{

AdminOptions ao=new AdminOptions();

}

}

39

Page 40: Aptech Computer Education

UserOption:-

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class UserOptions extends JFrame implements ActionListener

{

JButton b1,b5,b6;

JPanel p;

GridBagLayout gb;

GridBagConstraints gc;

UserOptions()

{

super("User Options");

p=new JPanel();

gb=new GridBagLayout();40

Page 41: Aptech Computer Education

gc=new GridBagConstraints();

Font f=new Font("Arial",Font.BOLD+Font.ITALIC,25);

b1=new JButton("Create Member");

//b2=new JButton("Stock Entry");

//b3=new JButton("Issue Book");

//b4=new JButton("Return Book");

b5=new JButton("View DefaulterList");

b6=new JButton("View Stock");

getContentPane().add(p);

p.setLayout(gb);

gc.anchor=GridBagConstraints.CENTER;

gc.fill=GridBagConstraints.NONE;

gc.gridx=5;

gc.gridy=5;

gb.setConstraints(b1,gc);

p.add(b1);

/*

gc.gridx=5;

gc.gridy=6;

gb.setConstraints(b2,gc);

p.add(b2);

gc.gridx=5;

gc.gridy=7;41

Page 42: Aptech Computer Education

gb.setConstraints(b3,gc);

p.add(b3);

gc.gridx=5;

gc.gridy=8;

gb.setConstraints(b4,gc);

p.add(b4);

*/

gc.gridx=5;

gc.gridy=9;

gb.setConstraints(b5,gc);

p.add(b5);

gc.gridx=5;

gc.gridy=10;

gb.setConstraints(b6,gc);

p.add(b6);

p.setBackground(Color.black);

b1.setBackground(Color.pink);

//b2.setBackground(Color.pink);

//b3.setBackground(Color.pink);

//b4.setBackground(Color.pink);

b5.setBackground(Color.pink);

b6.setBackground(Color.pink);

b1.setFont(f);42

Page 43: Aptech Computer Education

//b2.setFont(f);

//b3.setFont(f);

//b4.setFont(f);

b5.setFont(f);

b6.setFont(f);

b1.setForeground(Color.red);

//b2.setForeground(Color.red);

//b3.setForeground(Color.red);

//b4.setForeground(Color.red);

b5.setForeground(Color.red);

b6.setForeground(Color.red);

b1.addActionListener(this);

b5.addActionListener(this);

b6.addActionListener(this);

setSize(200,200);

setVisible(true);

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==b1)

{

Member m=new Member();

}43

Page 44: Aptech Computer Education

}

public static void main(String args[])

{

UserOptions ao=new UserOptions();

}

}

Member.java:-

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import java.awt.event.*;

public class Member extends JFrame implements ActionListener

{

JLabel lblName,lblAdd,lblMid,lblPass,lblEmail,lblMob;

JTextField txtName,txtMid,txtEmail,txtMob;

JTextArea taAdd;

JPasswordField txtPass;

JButton btnSubmit;

GridBagLayout gb;

GridBagConstraints gc;

JPanel p;

Member()44

Page 45: Aptech Computer Education

{

super("Enter Member Details");

gb=new GridBagLayout();

gc=new GridBagConstraints();

lblName=new JLabel("Name");

lblAdd=new JLabel("Address");

lblMid=new JLabel("Member ID");

lblPass=new JLabel("Password");

lblEmail=new JLabel("Email ID");

lblMob=new JLabel("Mobile No.");

txtName=new JTextField(10);

txtMid=new JTextField(10);

txtEmail=new JTextField(10);

txtMob=new JTextField(10);

taAdd=new JTextArea(3,20);

txtPass=new JPasswordField(10);

btnSubmit=new JButton("Submit");

p=new JPanel();

getContentPane().add(p);

p.setLayout(gb);

gc.anchor=GridBagConstraints.CENTER;

gc.fill=GridBagConstraints.NONE;

gc.gridx=5;

gc.gridy=5;

gb.setConstraints(lblName,gc);45

Page 46: Aptech Computer Education

p.add(lblName);

gc.gridx=6;

gc.gridy=5;

gb.setConstraints(txtName,gc);

p.add(txtName);

gc.gridx=5;

gc.gridy=6;

gb.setConstraints(lblAdd,gc);

p.add(lblAdd);

JScrollPane j=new JScrollPane(taAdd);

gc.gridx=6;

gc.gridy=6;

gb.setConstraints(j,gc);

p.add(j);

gc.gridx=5;

gc.gridy=7;

gb.setConstraints(lblMid,gc);

p.add(lblMid);

gc.gridx=6;

gc.gridy=7;46

Page 47: Aptech Computer Education

gb.setConstraints(txtMid,gc);

p.add(txtMid);

gc.gridx=5;

gc.gridy=8;

gb.setConstraints(lblPass,gc);

p.add(lblPass);

gc.gridx=6;

gc.gridy=8;

gb.setConstraints(txtPass,gc);

p.add(txtPass);

gc.gridx=5;

gc.gridy=9;

gb.setConstraints(lblEmail,gc);

p.add(lblEmail);

gc.gridx=6;

gc.gridy=9;

gb.setConstraints(txtEmail,gc);

p.add(txtEmail);

gc.gridx=5;

gc.gridy=10;47

Page 48: Aptech Computer Education

gb.setConstraints(lblMob,gc);

p.add(lblMob);

gc.gridx=6;

gc.gridy=10;

gb.setConstraints(txtMob,gc);

p.add(txtMob);

gc.gridx=6;

gc.gridy=11;

gb.setConstraints(btnSubmit,gc);

p.add(btnSubmit);

btnSubmit.addActionListener(this);

setSize(300,300);

setVisible(true);

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==btnSubmit)

{

try

{

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

Connection con=DriverManager.getConnection("jdbc:odbc:mydata","sa","");

48

Page 49: Aptech Computer Education

PreparedStatement pstat=con.prepareStatement("Insert into Member

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

pstat.setString(1,txtName.getText());

pstat.setString(2,taAdd.getText());

pstat.setString(3,txtMid.getText());

pstat.setString(4,txtPass.getText());

pstat.setString(5,txtEmail.getText());

pstat.setString(6,txtMob.getText());

pstat.executeUpdate();

JOptionPane.showMessageDialog(null,"Record saved");

}

catch(Exception ee)

{

System.out.println(ee);

}

}

}

//public static void main(String args[])

//{

//Member m=new Member();

//}

}

49

Page 50: Aptech Computer Education

Stock.java:-

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import java.awt.event.*;

class Stock extends JFrame implements ActionListener

{

JLabel

lblBookCode,lblNameOfBook,lblCategory,lblPublication,lblNo_OfBook,lblCurrentStatus;

JTextField

txtBookCode,txtNameOfBook,txtCategory,txtPublication,txtNo_OfBook,txtCurrentStatus;

50

Page 51: Aptech Computer Education

JButton btnSubmit;

GridBagLayout gb;

GridBagConstraints gc;

JPanel p;

Stock()

{

super("Enter Stock Details");

gb=new GridBagLayout();

gc=new GridBagConstraints();

lblBookCode=new JLabel("BookCode");

lblNameOfBook=new JLabel("Name Of Book");

lblCategory=new JLabel("Category");

lblPublication=new JLabel("Publication");

lblNo_OfBook=new JLabel("No Of Books");

lblCurrentStatus=new JLabel("Current Status");

txtBookCode=new JTextField(10);

txtNameOfBook=new JTextField(10);

txtCategory=new JTextField(10);

txtPublication=new JTextField(10);

txtNo_OfBook=new JTextField(10);

txtCurrentStatus=new JTextField(10);

btnSubmit=new JButton("Submit");

p=new JPanel();

getContentPane().add(p);

p.setLayout(gb);51

Page 52: Aptech Computer Education

gc.anchor=GridBagConstraints.CENTER;

gc.fill=GridBagConstraints.NONE;

gc.gridx=5;

gc.gridy=5;

gb.setConstraints(lblBookCode,gc);

p.add(lblBookCode);

gc.gridx=6;

gc.gridy=5;

gb.setConstraints(txtBookCode,gc);

p.add(txtBookCode);

gc.gridx=5;

gc.gridy=6;

gb.setConstraints(lblCategory,gc);

p.add(lblCategory);

gc.gridx=6;

gc.gridy=6;

gb.setConstraints(txtCategory,gc);

p.add(txtCategory);

gc.gridx=5;

gc.gridy=7;52

Page 53: Aptech Computer Education

gb.setConstraints(lblNo_OfBook,gc);

p.add(lblNo_OfBook);

gc.gridx=6;

gc.gridy=7;

gb.setConstraints(txtNo_OfBook,gc);

p.add(txtNo_OfBook);

gc.gridx=5;

gc.gridy=8;

gb.setConstraints(lblPublication,gc);

p.add(lblPublication);

gc.gridx=6;

gc.gridy=8;

gb.setConstraints(txtPublication,gc);

p.add(txtPublication);

gc.gridx=5;

gc.gridy=9;

gb.setConstraints(lblNameOfBook,gc);

p.add(lblNameOfBook);

gc.gridx=6;

gc.gridy=9;53

Page 54: Aptech Computer Education

gb.setConstraints(txtNameOfBook,gc);

p.add(txtNameOfBook);

gc.gridx=5;

gc.gridy=10;

gb.setConstraints(lblCurrentStatus,gc);

p.add(lblCurrentStatus);

gc.gridx=6;

gc.gridy=10;

gb.setConstraints(txtCurrentStatus,gc);

p.add(txtCurrentStatus);

gc.gridx=6;

gc.gridy=11;

gb.setConstraints(btnSubmit,gc);

p.add(btnSubmit);

btnSubmit.addActionListener(this);

setSize(300,300);

setVisible(true);

}

public void actionPerformed(ActionEvent e)

{54

Page 55: Aptech Computer Education

if(e.getSource()==btnSubmit)

{

try

{

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

Connection con=DriverManager.getConnection("jdbc:odbc:mydata","sa","");

PreparedStatement pstat=con.prepareStatement("Insert into Stock values(?,?,?,?,?,?)");

pstat.setString(1,txtBookCode.getText());

pstat.setString(2,txtCategory.getText());

pstat.setInt(3,Integer.parseInt(txtNo_OfBook.getText()));

pstat.setString(4,txtPublication.getText());

pstat.setString(5,txtNameOfBook.getText());

pstat.setString(6,txtCurrentStatus.getText());

pstat.executeUpdate();

JOptionPane.showMessageDialog(null,"Record saved");

}

catch(Exception ee)

{

System.out.println(ee);

}

}

}

public static void main(String args[])

{

Stock s=new Stock();55

Page 56: Aptech Computer Education

}

}

IssueBook.java:-

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.util.*;

import java.sql.*;

class IssueBook extends JFrame implements ActionListener

{

JLabel lblBookcode,lblMid,lblIssueDate,lblScheduleReturnDate;

JTextField txtBookcode,txtMid,txtIssueDate,txtScheduleReturnDate;

JButton btnSubmit,btnFind;

GridBagLayout gb;

GridBagConstraints gc;

JPanel p;56

Page 57: Aptech Computer Education

IssueBook()

{

super("Enter IssueBook Details");

gb=new GridBagLayout();

gc=new GridBagConstraints();

lblBookcode=new JLabel("Bookcode");

lblMid=new JLabel("Member ID");

lblIssueDate=new JLabel("IssueDate");

lblScheduleReturnDate=new JLabel("ScheduleReturnDate");

txtBookcode=new JTextField(10);

txtMid=new JTextField(10);

txtIssueDate=new JTextField(10);

txtScheduleReturnDate=new JTextField(10);

btnFind=new JButton("Find");

btnSubmit=new JButton("Submit");

p=new JPanel();

getContentPane().add(p);

p.setLayout(gb);

gc.anchor=GridBagConstraints.CENTER;

gc.fill=GridBagConstraints.NONE;

gc.gridx=5;

gc.gridy=5;

gb.setConstraints(lblBookcode,gc);

p.add(lblBookcode);57

Page 58: Aptech Computer Education

gc.gridx=6;

gc.gridy=5;

gb.setConstraints(txtBookcode,gc);

p.add(txtBookcode);

gc.gridx=5;

gc.gridy=7;

gb.setConstraints(lblMid,gc);

p.add(lblMid);

gc.gridx=6;

gc.gridy=7;

gb.setConstraints(txtMid,gc);

p.add(txtMid);

gc.gridx=5;

gc.gridy=8;

gb.setConstraints(lblIssueDate,gc);

p.add(lblIssueDate);

gc.gridx=6;

gc.gridy=8;

gb.setConstraints(txtIssueDate,gc);

p.add(txtIssueDate);58

Page 59: Aptech Computer Education

gc.gridx=7;

gc.gridy=8;

gb.setConstraints(btnFind,gc);

p.add(btnFind);

gc.gridx=5;

gc.gridy=9;

gb.setConstraints(lblScheduleReturnDate,gc);

p.add(lblScheduleReturnDate);

gc.gridx=6;

gc.gridy=9;

gb.setConstraints(txtScheduleReturnDate,gc);

p.add(txtScheduleReturnDate);

gc.gridx=6;

gc.gridy=11;

gb.setConstraints(btnSubmit,gc);

p.add(btnSubmit);

btnSubmit.addActionListener(this);59

Page 60: Aptech Computer Education

btnFind.addActionListener(this);

setSize(300,300);

setVisible(true);

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==btnFind)

{

String strDt=txtIssueDate.getText();

java.util.Date dt=new java.util.Date(java.util.Date.parse(strDt));

System.out.println(dt);

GregorianCalendar cal=new GregorianCalendar();

cal.setTime(dt);

//String strDtVal=cal.get(Calendar.MONTH)+"/"+cal.get(Calendar.DATE)

+"/"+cal.get(Calendar.YEAR);

//txtScheduleReturnDate.setText(strDtVal);

int d=cal.get(Calendar.DATE);

d=d+7;

dt.setDate(d);

cal.setTime(dt);

String strDtVal=cal.get(Calendar.MONTH)+"/"+cal.get(Calendar.DATE)

+"/"+cal.get(Calendar.YEAR);

int m=cal.get(Calendar.MONTH)+1;

dt.setMonth(m);

cal.setTime(dt);

60

Page 61: Aptech Computer Education

String strDtVal1=cal.get(Calendar.MONTH)+"/"+cal.get(Calendar.DATE)

+"/"+cal.get(Calendar.YEAR);

txtScheduleReturnDate.setText(strDtVal1);

}

if(e.getSource()==btnSubmit)

{

try

{

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

Connection con=DriverManager.getConnection("jdbc:odbc:mydata","sa","");

PreparedStatement pstat=con.prepareStatement("Insert into

transactions(BookCode,Mid,IssueDate,SchRetDate) values(?,?,?,?)");

pstat.setString(1,txtBookcode.getText());

pstat.setString(2,txtMid.getText());

pstat.setString(3,txtIssueDate.getText());

pstat.setString(4,txtScheduleReturnDate.getText());

pstat.executeUpdate();

JOptionPane.showMessageDialog(null,"Record saved");

}

catch(Exception ee)

{

System.out.println(ee);

}

}

}

61

Page 62: Aptech Computer Education

public static void main(String args[])

{

IssueBook Im=new IssueBook();

}

}

ReturnBook.java:

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import java.awt.event.*;

import java.util.*;

class ReturnBook extends JFrame implements ActionListener

{

JLabel lblBookCode,lblMid,lblScheduledReturnDate,lblActulReturnDate,lblFine;

JTextField txtBookCode,txtMid,txtScheduledReturnDate,txtActulReturnDate,txtFine;

JButton btnSubmit;

JButton btnCalculate;

GridBagLayout gb;

GridBagConstraints gc;

JPanel p;

ReturnBook()

{62

Page 63: Aptech Computer Education

super("Enter ReturnBook Details");

gb=new GridBagLayout();

gc=new GridBagConstraints();

lblBookCode=new JLabel("BookCode");

lblMid=new JLabel("Member ID");

lblScheduledReturnDate=new JLabel("ScheduledReturnDate");

lblFine=new JLabel("Fine");

lblActulReturnDate=new JLabel("ActulReturnDate");

txtFine=new JTextField(10);

txtBookCode=new JTextField(10);

txtMid=new JTextField(10);

txtScheduledReturnDate=new JTextField(10);

txtActulReturnDate=new JTextField(10);

btnSubmit=new JButton("Submit");

btnCalculate=new JButton("Calculate");

p=new JPanel();

getContentPane().add(p);

p.setLayout(gb);

gc.anchor=GridBagConstraints.CENTER;

gc.fill=GridBagConstraints.NONE;

gc.gridx=5;

gc.gridy=5;

gb.setConstraints(lblBookCode,gc);63

Page 64: Aptech Computer Education

p.add(lblBookCode);

gc.gridx=6;

gc.gridy=5;

gb.setConstraints(txtBookCode,gc);

p.add(txtBookCode);

gc.gridx=5;

gc.gridy=7;

gb.setConstraints(lblMid,gc);

p.add(lblMid);

gc.gridx=6;

gc.gridy=7;

gb.setConstraints(txtMid,gc);

p.add(txtMid);

gc.gridx=5;

gc.gridy=8;

gb.setConstraints(lblScheduledReturnDate,gc);

p.add(lblScheduledReturnDate);

gc.gridx=6;64

Page 65: Aptech Computer Education

gc.gridy=8;

gb.setConstraints(txtScheduledReturnDate,gc);

p.add(txtScheduledReturnDate);

gc.gridx=5;

gc.gridy=9;

gb.setConstraints(lblActulReturnDate,gc);

p.add(lblActulReturnDate);

gc.gridx=6;

gc.gridy=9;

gb.setConstraints(txtActulReturnDate,gc);

p.add(txtActulReturnDate);

gc.gridx=5;

gc.gridy=10;

gb.setConstraints(lblFine,gc);

p.add(lblFine);

gc.gridx=6;

gc.gridy=10;

gb.setConstraints(txtFine,gc);

p.add(txtFine);

gc.gridx=7;65

Page 66: Aptech Computer Education

gc.gridy=10;

gb.setConstraints(btnCalculate,gc);

p.add(btnCalculate);

gc.gridx=6;

gc.gridy=11;

gb.setConstraints(btnSubmit,gc);

p.add(btnSubmit);

btnCalculate.addActionListener(this);

btnSubmit.addActionListener(this);

setSize(300,300);

setVisible(true);

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==btnCalculate)

{

String strDt1=txtScheduledReturnDate.getText();

java.util.Date dt1=new java.util.Date(java.util.Date.parse(strDt1));

String strDt2=txtActulReturnDate.getText();

java.util.Date dt2=new java.util.Date(java.util.Date.parse(strDt2));

GregorianCalendar cal1=new GregorianCalendar();

GregorianCalendar cal2=new GregorianCalendar();66

Page 67: Aptech Computer Education

cal1.setTime(dt1);

cal2.setTime(dt2);

int dd2=cal2.get(Calendar.DATE);

int dd1=cal1.get(Calendar.DATE);

int diff=dd2-dd1;

if(diff>7)

{

int fine=diff*10;

txtFine.setText(String.valueOf(fine));

}

System.out.println(dd2);

System.out.println(dd1);

System.out.println(dd2-dd1);

}

if(e.getSource()==btnSubmit)

{

try

{

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

Connection con=DriverManager.getConnection("jdbc:odbc:mydata","sa","");

PreparedStatement pstat=con.prepareStatement("update transactions set

ActRetDate=?,fine=? where bookcode=? and mid=? and ActRetDate is null");

pstat.setString(1,txtActulReturnDate.getText());

pstat.setInt(2,Integer.parseInt(txtFine.getText()));

pstat.setString(3,txtBookCode.getText());

67

Page 68: Aptech Computer Education

pstat.setString(4,txtMid.getText());

pstat.executeUpdate();

JOptionPane.showMessageDialog(null,"Record saved");

}

catch(Exception ee)

{

System.out.println(ee);

}

}

}

public static void main(String args[])

{

ReturnBook m=new ReturnBook();

}

}

68

Page 69: Aptech Computer Education

SQL Code For BackEnd:-

select * from sysobjects where type='u'

create table Stock

(

BookCode char(10),

Category varchar(30),

NoOfBooks int,

Publication varchar(30),

BookName varchar(30),

CurrStatus varchar(30)

)

select * from stock

create table Transactions

(

BookCode char(10),

Mid char(10),69

Page 70: Aptech Computer Education

IssueDate datetime,

SchRetDate datetime,

ActRetDate datetime,

Fine int

)

create table member

(

name varchar(20),

address varchar(30),

mid varchar(20),

password varchar(20),

email_id varchar(20),

mobile_no. int

)

create table issuebook

(

bcode varchar(20),

mid varchar(20),

issuedate date,

sreturndate date

)

create table authentication

(

users varchar(20),

pwd password(20)70

Page 71: Aptech Computer Education

)

insert into authentication values('user','user123')

Chapter 8

Snapshot

71

Page 72: Aptech Computer Education

72

Page 73: Aptech Computer Education

73

Page 74: Aptech Computer Education

74

Page 75: Aptech Computer Education

75

Page 76: Aptech Computer Education

76

Page 77: Aptech Computer Education

Chapter 9

Conclusion

In the current age of computers, efforts have been made to cover every aspect of human life

with faster computing power of digital computers. Especially in a large organization, where

enormous amount of data are to be processed every day and interaction between different

working groups of organization for taking crucial decisions exists, there is a desire to have

comprehensive information available more quickly in order to improve quality, productivity,

cost effectiveness, planning, policy decision making and constant vigil on production.

Therefore, a systematic effort to reduce the information uncertainties becomes an important

driving factor for establishment of automatic system. This project will help the administration

in updating, creating, deleting the record of membership as per requirement and

implementation plans.

77

Page 78: Aptech Computer Education

Chapter 10

Bibliography & References

Internet:

www.wikipedia.com

www.oracle.com

www.w3school.com

www.1000projects.com

Books:

The Complete Reference, Seventh Edition by Herbert Schildt

Java script by R.Allene Wyke, Jason D. Gillian and Chariton

78

Page 79: Aptech Computer Education

79