Java Project File Sem 6
Java Project File Sem 6
On
Madame Management
Page 1
ACKNOWLEDGEMENT
Lastly,I thank almighty,my Parents and friends for the constant encouragement
without which this project would not be possible.
Satya Prakash
172/CSE/19
Sem:- 6th
Page 2
ABSTRACT
We have learnt a lot during this project and liked the improvement in our testing skills and deep
concept related to these kinds of projects.
Our project is “Madame Management”. This is a offline application which helps people to give
the facility to manage the details of staff details, customer details, discounts and other
facilities provided to customers.
Page 3
PREFACE
Learning comes from doing. To learn something one has to go through Practical conditions.
Recognizing this fact, the University has made it essential forB.Tech students to undergo
Industrial Training for six weeks. During this period, the student learns about the functioning of
the organization and the actual business environment. Also this training helps the student how to
implement the theoretical knowledge into practical life, in our day to day life. This project report
was prepared during the training period in the month of May – June.
During this period, an effort was made to understand “Madame Management” and to finish the
project work assigned to us. This report lays special emphasis on the operational work, tasks and
projects carried out during the training period.
Page 4
LIST OF CONTENTS
Page 5
Certificate
Page 6
PROJECT DESCRIPTION
We made this application in Core java and my database is MS SQL Server 2005. We
have our database in application folder App data. To run this application just attaches this
database on your machine and change the connection string.
Now when you run the application for the first time the login page will show. If you
have already registered with the site, then enter your username and password and the application
will redirect to your login page.
Page 7
COMPONENTS OF THE PROJECT
1. How to Login
a. In this module, the user will enter his username and password to goto home page.
2. Home Page.
Customer Details : This button refers to the page of Customer details who are
registered.
Staff Info: This button refers to the page of general information of staff of
madame showroom.
Inventory: This button refers to the page of details of products available and
required.
Bill: This button refers to the page which contains discounts and products
information of the products customer requires.
Page 8
REQUIREMENT ANALYSIS
Hardware Requirements
Number Description
1 Computer System
2 1GBRAM
Software Requirements
Number Description
1 Windows XP –7,any OS supporting NetBeans and
MsSQL
2 NetBeans
3 MsSql Server 2005
Page 9
INTRODUCTION TO TOOLS
FRONT-END/BACK-END
Front-End: NetBeans
Front End:
Net Beans– Net Beans is an integrated development environment (IDE) from Sun
Microsystems. It is used to develop console and graphical user interface applications along
with Windows Forms applications, web sites, web applications, and web services.
NetBeans supports different programming languages by means of language services,
which allow the code editor and debugger to support (to varying degrees) nearly any
programming language, provided a language-specific service exists. Built-in languages
include C/C++ .
Backend:
SQLSERVER– Microsoft SQL Server is a relational database server, developed by
Microsoft: it is a software product whose primary function is to store and retrieve data as
requested by other software applications, be it those on the same computer or those
running on another computer across a network (including the Internet). There are at least
a dozen different editions of Microsoft SQL Server aimed at different audiences and for
different workloads (ranging from small applications that store and retrieve data on the
same computer, to millions of users and computers that access huge amounts of data from
the Internet at the same time).
Page 10
HISTORY
The Java platform and language began as an internal project at Sun Microsystems in
December 1990, providing an alternative to the C++/C programming languages. Engineer
Patrick Naughton had become increasingly frustrated with the state of Sun's C++ and C
application programming interfaces (APIs) and tools. While considering moving to NeXT,
Naughton was offered a chance to work on new technology and thus the Stealth Project was
started.
The Stealth Project was soon renamed to the Green Project with James Gosling and
Mike Sheridan joining Naughton. Together with other engineers, they began work in a small
office on Sand Hill Road in Menlo Park, California. They were attempting to develop a new
technology for programming next generation smart appliances, which Sun expected to be a major
new opportunity.
The team originally considered using C++, but it was rejected for several reasons.
Because they were developing an embedded system with limited resources, they decided that
C++ needed too much memory and that its complexity led to developer errors. The language's
lack of garbage collection meant that programmers had to manually manage system memory, a
challenging and error-prone task. The team was also troubled by the language's lack of portable
facilities for security, distributed programming, and threading. Finally, they wanted a platform
that could be easily ported to all types of devices.
Bill Joy had envisioned a new language combining Mesa and C. In a paper
called Further, he proposed to Sun that its engineers should produce an object-oriented
environment based on C++. Initially, Gosling attempted to modify and extend C++ (that he
referred to as "C++ ++ --") but soon abandoned that in favor of creating a new language, which
he called Oak, after the tree that stood just outside his office.
Page 11
By the summer of 1992, they were able to demonstrate portions of the new platform
including the Green OS, the Oak language, the libraries, and the hardware. Their first attempt,
demonstrated on September 3, 1992, focused on building a personal digital assistant (PDA)
device named Star7 that had a graphical interface and a smart agent called "Duke‖to assist the
user.
In November of that year, the Green Project was spun off to become firstperson, a
wholly owned subsidiary of Sun Microsystems, and the team relocated to Palo Alto, California.
The first person team was interested in building highly interactive devices, and when Time
Warner issued a request for proposal (RFP) for a set-top box, firstperson changed their target and
responded with a proposal for a set-top box platform. However, the cable industry felt that their
platform gave too much control to the user and firstperson lost their bid to SGI. An additional
deal with The 3DO Company for a set-top box also failed to materialize. Unable to generate
interest within the TV industry, the company was rolled back into Sun.
Page 12
INTRODUCTION TO JAVA
Much of the syntax of Java is the same as C and C++. One major difference is that
Java does not have pointers. However, the biggest difference is that you must write object
oriented code in Java. Procedural pieces of code can only be embedded in objects. In the
following we assume that the reader has some familiarity with a programming language. In
particular, some familiarity with the syntax of C/C++ is useful.
In Java we distinguish between applications, which are programs that perform the
same functions as those written in other programming languages, and applets, which are
programs that can be embedded in a Web page and accessed over the Internet. Our initial focus
will be on writing applications. When a program is compiled, a byte code is produced that can be
read and executed by any platform that can run Java.
Page 13
Java Features
Java is simple, easy to design , easy to write, and therefore easy to compile, debug, and learn
than any other programming languages.
Java is object-oriented, that is used to build modular programs and reusable code in other
application.
Java is platform-independent and flexible in nature. The most significant feature of Java is to
run a program easily from one computer system to another.
Java works on distributed environment. It is designed to work on distributed computing , Any
network programs in Java is same as sending and receiving data to and from a file.
Java is secure. The Java language, compiler, interpreter and runtime environment are
securable .
Java is robust. Robust means reliability. Java emphasis on checking for possible errors, as
Java compilers are able to detect many error problem in program during the execution of
respective program code.
Java supports multithreaded. Multithreaded is the path of execution for a program to perform
several tasks simultaneously within a program. The java come with the concept of
Multithreaded Program. In other languages, operating system-specific procedures have to be
called in order to work on multithreading.
Java fully follows oops.
Page 14
The Simple Types
Java defines eight simple (or elemental) types of data: byte, short, int, long, char, float,
double, and boolean.
1) Integers :
This group includes byte, short, int, and long, which are for whole-valued signed
numbers. Floating-point numbers This group includes float and double, which represent
numbers with fractional precision. All of these are signed, positive and negative values. Java
does not support unsigned, positive -only integers. The width of an integer type should not be
thought of as the amount of storage it consumes, but rather as the behavior it defines for
variables and expressions of that type.
The Java run-time environment is free to use whatever size it wants, as long as the
types behave as you declared them. In fact, at least one implementation stores bytes and shorts
as 32-bit (rather than 8- and 16-bit) values to improve performance, because that is the word size
of most computers currently in use.
The width and ranges of these integer types vary widely, as shown in this table:
a) Byte
The smallest integer type is byte. This is a signed 8-bit type that has a range from –128
to 127. Variables of type byte are especially useful when you're working with a stream of data
from a network or file. They are also useful when you're working with raw binary data that may
not be directly compatible with Java's other built -in types. Byte variables are declared by use of
the byte keyword. For example, the following declares two byte variables called b and c:
byte b, c;
Page 15
b) Short
Short is a signed 16-bit type. It has a range from –32,768 to 32,767. It is probably the
least-used Java type, since it is defined as having its high byte first (called big-endian format).
This type is mostly applicable to 16 -bit computers, which are becoming increasingly scarce.
c) Int
The most commonly used integer type is int. It is a signed 32-bit type that has a range. Its
range is from –2,147,483,648 to 2,147,483,647. Any time you have an integer expression
involving bytes, shorts, ints, and literal numbers, the entire expression is promoted to int before
the calculation is done.
d) Long
Long is a signed 64-bit type and is useful for those occasions where an int type is not large
enough to hold the desired value. The range of a long is quite large. This makes it useful when
big, whole numbers are needed.
.
2) Floating-Point Types
Floating-point numbers, also known as real numbers, are used when evaluation expressions
that require fractional precision. There are two kinds of floating -point types, float and double,
which represent single- and double-precision numbers. Their width and ranges are shown here:
Page 16
a) Float
The type float specifies a single-precision value that uses 32 bits of storage. Single
precision is faster on some processors and takes half as much space as double precision,
but will become imprecise when the values are either very large or very small. Variables of
type float are useful when you need a fractional component, but don't require a large degree
of precision. For example, float can be useful when representing dollars and cents. Here are
some example float variable declarations: float hightemp, lowtemp.
b) Double
Double precision, as denoted by the double keyword, uses 64 bits to store a value. Double
precision is actually faster than single precision on some modern processors that have been
optimized for high -speed mathematical calculations. All transcendental math functions, such
as sin( ), cos( ), and sqrt( ), return double values. When you need to maintain accuracy over
many iterative calculations, or are manipulating large –valued numbers, double is the best
choice. Here is a short program that uses double variables to compute the area of a circle:
Compute the area of a circle.
class Area {
public static void main(String args[]) {
double pi, r, a;
r = 10.8; // radius of circle
pi = 3.1416; // pi, approximately
a = pi * r * r; // compute area
System.out.println("Area of circle is " + a);}}
3) Characters
This group includes char, which represents symbols in a character set, like letters and
numbers. In Java, the data type used to store characters is char. Java uses Unicode to represent
characters. Unicode defines a fully international character set that can represent all of the
characters found in all human languages. In Java char is a 16-bit type. The range of a char is 0
to 65,536. There are no negative chars. The standard set of characters known as ASCII still
Page 17
ranges from 0 to 127 as always, and the extended 8 -bit character set, ISO-Latin-1, ranges from 0
to 255.
Notice that ch1 is assigned the value 88, which is the ASCII (and Unicode) value that
corresponds to the letter X.
Even though chars are not integers, in many cases you can operate on them as if they
Were integers. This allows you to add two characters together, or to increment the value
of a character variable.
Page 18
4) Boolean
This group includes boolean, which is a special type for representing true/false values.
You can use these types as -is, or to construct arrays or your own class types. Thus, they
form the basis for all other types of data that you can create. Java has a simple type, called
boolean, for logical values. It can have only one of two possible values, true or false. This
is the type returned by all relational operators, such as a < b. boolean is also the type
required by the conditional expressions that govern the control statements such as if and for.
Here is a program that demonstrates the boolean type:
// Demonstrate boolean values.
class BoolTest
{
public static void main(String args[])
{
boolean b;
b = false;
System.out.println("b is " + b);
b = true;
System.out.println("b is " + b);
// a boolean value can control the if statement
if(b) System.out.println("This is executed.");
b = false;
if(b) System.out.println("This is not executed.");
// outcome of a relational operator is a boo lean value
System.out.println("10 > 9 is " + (10 > 9));
}
}
The output generated by this program is shown here:
b is false
b is true
This is executed.
10 > 9 is true
Page 19
There are three interesting things to notice about this program. First, as you can see,
when a boolean value is output by println( ), "true" or "false" is displayed. Second, the
value of a boolean variable is sufficient, by itself, to control the if statement. There is
no need to write an if statement like this:
if(b == true) ...
Third, the outcome of a relational operator, such as <, is a boolean value. This is why
the expression 10 > 9 displays the value "true."
If you have previous programming experience, then you already know that it is fairly
common to assign a value of one type to a varia ble of another type. If the two types are
compatible, then Java will perform the conversion automatic ally. For example, it is always
possible to assign an int value to a long variable. However, not all types are compatible, and
thus, not all type conversio ns are implicitly allowed. For instance, there is no conversion defined
from double to byte. To do so, you must use a cast, which performs an explicit conversion
between incompatible types. Let's look at both automatic type conversions and casting.
When these two conditions are met, a widening conversion takes place. For
example, the int type is always large enough to hold all valid byte values, so no explicit
cast statement is required. For widening conversions, the numeric types, including integer
and floating-point types, are compatible with each other. However, the numeric types are
not compatible with char or Boolean . Also, char and boolean are not compatible with
each other.
Page 20
As mentioned earlier, Java also performs an automatic type conversion when storing a
literal integer constant into variables of type byte, short, or long.
To create a conversion between two incompatible types, you must use a cast. A cast is
simply an explicit type conversion.
It has this general form:
(target-type) value. Here, target-type specifies the desired type to convert the specified value to.
For example, the following fragment casts an int to a byte. If the integer's value is larger than the
range of a byte, it will be reduced modulo byte's range.
int a;
byte b;
// ...
b = (byte) a;
A different type of conversion will occur when a floating -point value is assigned to an
integer type: truncation. As you know, integers do not ha ve fractional components. Thus, when
a floating-point value is assigned to an integer type, the fractional
component is lost. For example, if the value 1.23 is assigned to an integer, the resulting value
will simply be 1. The 0.23 will have been truncated. Of course, if the size of the whole number
component is too larg e to fit into the target integer type, then that value will be reduced modulo
the target type's range.
The following program demonstrates some type conversions that require casts:
// Demonstrate casts.
class Conversion {
public static void main(String args []) {
byte b;
Page 21
int i = 257;
double d = 323.142;
System.out.println("\\nConversion of int to byte.");
b = (byte) i;
System.out.println("i and b " + i + " " + b);
System.out.println("\\nConversion of double to int.");
i = (int) d;
System.out.println("d and i " + d + " " + i);
System.out.println("\\nConversion of double to byte.");
b = (byte) d;
System.out.println("d and b " + d + " " + b);
}
}
This program generates the following output:
Conversion of int to byte.
i and b 257 1
Conversion of double to int.
Core Java Student Guide Page 19 of
95
d and i 323.142 323
Conversion of double to byte.
d and b 323.142 67
Page 22
Inheritance in Java
Inheritance is a compile-time mechanism in Java that allows you to extend a class (called
the base class or super class) with another class (called the derived class or subclass). In Java,
inheritance is used for two purposes:
1. class inheritance - create a new class as an extension of another class, primarily for the
purpose of code reuse. That is, the derived class inherits the public methods and public data of
the base class. Java only allows a class to have one immediate base class, i.e., single class
inheritance.
2. interface inheritance - create a new class to implement the methods defined as part of an
interface for the purpose of subtyping. That is a class that implements an interface ―conforms
to‖ (or is constrained by the type of) the interface. Java supports multiple interface inheritance.
In Java, these two kinds of inheritance are made distinct by using different language syntax. For
class inheritance, Java uses the keyword extends and for interface inheritance Java uses the
Keyword implements.
Page 23
Class inheritance
This mechanism of deriving a new class from existing/old class is called ―inheritance‖. The old
class is known as ―base‖ class, ―super‖ class or ―parent‖ class‖; and the new class is known as
―sub‖ class, ―derived‖ class, or ―child‖ class. The inheritance allows subclasses to inherit all
properties (variables and methods) of their parent classes.
An abstract class is a class that leaves one or more method implementations unspecified
by declaring one or more methods abstract. An abstract method has no body (i.e., no
implementation). A subclass is required to override the abstract method and provide an
implementation. Hence, an abstract class is incomplete and cannot be instantiated, but
can be used as a base class.
abstract public class abstract-base-class-name
{
// abstract class has at least one abstract method
public abstract return-type abstract-method-name ( formal-params );
... // other abstract methods, object methods, class methods
}
Page 24
public class derived-class-name extends abstract-base-class-name {
public return-type abstract-method-name (formal-params) { stmt-list; }
... // other method implementations
}
It would be an error to try to instantiate an object of an abstract type:
abstract-class-name obj = new abstract-class-name(); // ERROR!
That is, operator new is invalid when applied to an abstract class.
Constructors in Java
All about allocating resources before an object is use And freeing resources when an object is
done.
Constructors are done right in Java and make a lot of sense.
Default Values
• At object allocation
— Java assigns each member var its default value
• If you want, you can give an explicit initialization
class Foo
{
private int a = 12;
private IDoubleVector b = new DenseDoubVector (2, 0);
private double c;
...
}
Page 25
Providing Initialization Code
Can have a block of code that is always run before constructor
class Foo
{
int a;
{
System.out.println (―This code’ll run before the‖);
System.out.println (―constructor.‖);
}
Foo () {
System.out.println (―Here is the constructor.‖);
}
}
Foo bar = new Foo ();
• What does this do?
•Note: can have block labeled ―static‖... what happens then?
Page 26
System.out.println (―Here is the constructor.‖);
}
} ...
Foo bar = new Foo ();
Interface
● It defines a standard and public way of specifying the behavior of classes
– Defines a contract
● All methods of an interface are abstract methods
– Defines the signatures of a set of methods, without the body (implementation of the methods)
● A concrete class must implement the interface (all the abstract methods of the Interface)
● It allows classes, regardless of their locations in the class hierarchy, to implement common
behaviors.
Why Interfaces?
Page 27
Multi-Threading in java
Executing program with multiple threads in parallel
Special form of multiprocessing
Thread
sequentially executed stream of instructions
Shares address space with other threads
Has own execution context
Multiple threads in process execute same program also known as ―lightweight process‖.
Page 28
Thread Class
Runnable interface
Create object implementing Runnable interface Pass it to Thread object via Thread constructor
Example
public class MyT implements Runnable
{
public void run() {
… // work for thread
}
}
Thread t = new Thread(new MyT()); // create thread
t.start(); // begin running thread
… // thread executing in parallel
Page 29
Alternative (Not Recommended)
IO,Slee IO
p,join COMPLETE,SLEE
Termianted Blocked state P EXPIRED
state
Page 30
Java swings
What is Swing?
Swing Components:
Page 31
Event Handling
GUIs are event‐driven – user choose to act and the GUI responds via an event handler
What fires?
Page 32
Madame Management
In this project we are showing a Showroom Management functionality. In this Project We have
one panel: Admin Panel. Admin can insert ,update or delete customers to customer details and
also staff detais database.
We made this application in Core java and my database is MS SQL Server 2005. We have our
database in application folder App_data. To run this application just attaches this database on
your machine and change the connection string. Now when you run the application for the first
time the login page will show. If you have already registered with the site, then enter your
username and password and the application will redirect to your login page.
Login
Home page
page
Madame
Custome Invent
r detail managment ory
Staff bill
Information
n
Page 33
DATABASES
size
C_id
name L name
available P_no
phone address
Email id
price
E mail id Work
experience
Mobile
date
User
name
Page 34
SCREEN SHOTS OF PROJECT
Log-in Page: Customer and staff who are already registered will fill their username & password
otherwise they will get registered first by clicking on register button.
Page 35
Home page: our home page contains 4 buttons which are bill, customer details , inventory, staff
information.
Registeration page: Any new user will get registered first and then will be able to goto home
page.
Page 36
Staff info: This page will contain the general information about the staff members of showroom.
Customer details: This page will contains the basic information about customers .
Page 37
Inventory: This page will keep the record of number of items present in showroom as well as
required no. of items.
No. of items available/required :this page will help to know no. of item of that particular
product Present and required in showroom.
Page 38
Page 39