8/12/2019 143160095 Java Project Report
1/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 1
Six Months Industrial Training Project reportOn
Madame Management
Baba Farid College Of Engineering and Technology
Bathinda
Submitted To:
Submitted By:
Jaspreet Kaur(90080302449)
Lovleen Gupta(90080302458)
Samandeep Kaur(90080302476)
8/12/2019 143160095 Java Project Report
2/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 2
ACKNOWLEDGEMENT
I would like to thank Mr. MJS Dhillon (Director of INFOWIZ)for providing this opportunity to
take training on Core Java/Android technology under his guidance.
I would like to humbly and sincerely thank to Ms. Jenifa Chauhan, (Supervisor and
Department Manager) and Mr. Ankur (Trainer), INFOWIZ for their generous guidance,
valuable suggestions and encouragement given to me at different stages.
Last but not the least, I express my heartiest gratitude to Almighty god, my Parents for their love
and blessings to get such a wonderful opportunity
8/12/2019 143160095 Java Project Report
3/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 3
ABSTRACT
This is a project report on madame management During the making/developing of this
project we explored new ideas and functionality behind the working of a notepad.
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
facilitiesprovided to customers.
8/12/2019 143160095 Java Project Report
4/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 4
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 Managementand 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.
8/12/2019 143160095 Java Project Report
5/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 5
LIST OF CONTENTS
Sr.No. CONTENTS PAGE NO Remarks
1. FrontPage 1
2. Acknowledgement 2
3. Abstract 3
4. Preface 4
5. List of contents 5
6. Organization Overview 6
7. Project Description 7
8. Components of Projects 8
9. Requirement Analysis 9
10. Java history 10-11
11. Java concepts 12-31
12. System Design
1. Data Flow Diagrams2. Screen Shots
32-37
8/12/2019 143160095 Java Project Report
6/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 6
COMPANY PROFILE
INFOWIZ is an 6 years young organization with ISO Certification which has been working in the field of
IT , Embedded System and has been providing its clients with exceptional quality in Web Design, Web
Development and SEO services. Our clients range from small, medium to large scale Business houses &
individuals. We also provide the off shore companies of US, UK, France, Ireland, Canada and Australiawith quality and timely Web and SEO services.
INFOWIZ is an organization which is established in the field of Web Development ( PHP &
.NET ), JAVA (Core as well as Advance), Iphone & Android Applications, Embedded
systems(AVR, PIC & ARM), and ROBOTICS.
INFOWIZ does not boast itself of being the best Development Company but enjoys reputable
position among top Web Development and Electronics companies because of our timely delivery
and quality work. Our skilled team of professionals make sure that the product is developed as
per the customers needs and also keeping the customer informed about the development of his
project from time to time. We do not only emphasize on formulating an attractive solution to our
clients but also believe in providing a workable solution. INFOWIZ offers research based Search
Engine Marketing products that help achieve greater insights to customers online business. Our
Research & Development arm offers SEO tools for SEM professionals.
8/12/2019 143160095 Java Project Report
7/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 7
PROJECT DESCRIPTION
This is an Madame Managementproject. 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 details database.
We made this application in Core java and my database is MS SQL Server 2005. Wehave 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.
8/12/2019 143160095 Java Project Report
8/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 8
COMPONENTS OF THE PROJECT
1. How to Logina. 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 ofmadame showroom.
Inventory:This button refers to the page of details of products available andrequired.
Bill: This button refers to the page which contains discounts and productsinformation of the products customer requires.
8/12/2019 143160095 Java Project Report
9/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 9
REQUIREMENT ANALYSIS
Hardware Requirements
Number Description
1 Computer System
2 1GBRAM
Software Requirements
Number Description
1 Windows XP7,any OS supporting NetBeans and
MsSQL
2 NetBeans
3 MsSql Server 2005
8/12/2019 143160095 Java Project Report
10/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 10
INTRODUCTION TO TOOLS
FRONT-END/BACK-END
Front-End: NetBeans
Back-End: MsSQL SERVER 2005
Front End:
Net Beans Net Beans is an integrated development environment (IDE) from SunMicrosystems. It is used to developconsole andgraphical user interfaceapplications 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
includeC/C++ .
Backend:
SQLSERVERMicrosoft SQL Serveris arelational database server,developed byMicrosoft: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).
http://en.wikipedia.org/wiki/Integrated_development_environmenthttp://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/Console_applicationhttp://en.wikipedia.org/wiki/Graphical_user_interfacehttp://en.wikipedia.org/wiki/Application_softwarehttp://en.wikipedia.org/wiki/Application_softwarehttp://en.wikipedia.org/wiki/Windows_Formshttp://en.wikipedia.org/wiki/Web_sitehttp://en.wikipedia.org/wiki/Web_applicationhttp://en.wikipedia.org/wiki/Web_servicehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/C_%28programming_language%29http://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/Relational_database_management_systemhttp://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/Relational_database_management_systemhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C_%28programming_language%29http://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Web_servicehttp://en.wikipedia.org/wiki/Web_applicationhttp://en.wikipedia.org/wiki/Web_sitehttp://en.wikipedia.org/wiki/Windows_Formshttp://en.wikipedia.org/wiki/Application_softwarehttp://en.wikipedia.org/wiki/Graphical_user_interfacehttp://en.wikipedia.org/wiki/Console_applicationhttp://en.wikipedia.org/wiki/Microsofthttp://en.wikipedia.org/wiki/Integrated_development_environment8/12/2019 143160095 Java Project Report
11/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 11
HISTORY
The Java platform and language began as an internal project atSun 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 withJames 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 ofgarbage 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-orientedenvironment 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 calledOak,after the tree that stood just outside his office.
http://en.wikipedia.org/wiki/Sun_Microsystemshttp://en.wikipedia.org/wiki/C_%28programming_language%29http://en.wikipedia.org/wiki/Patrick_Naughtonhttp://en.wikipedia.org/wiki/Application_programming_interfacehttp://en.wikipedia.org/wiki/NeXThttp://en.wikipedia.org/wiki/James_Goslinghttp://en.wikipedia.org/wiki/Sand_Hill_Roadhttp://en.wikipedia.org/wiki/Menlo_Park,_Californiahttp://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29http://en.wikipedia.org/wiki/Distributed_programminghttp://en.wikipedia.org/wiki/Thread_%28computer_science%29http://en.wikipedia.org/wiki/Bill_Joyhttp://en.wikipedia.org/wiki/Mesa_%28programming_language%29http://en.wikipedia.org/wiki/Object-oriented_programminghttp://en.wikipedia.org/wiki/Oak_%28programming_language%29http://en.wikipedia.org/wiki/Oak_%28programming_language%29http://en.wikipedia.org/wiki/Object-oriented_programminghttp://en.wikipedia.org/wiki/Mesa_%28programming_language%29http://en.wikipedia.org/wiki/Bill_Joyhttp://en.wikipedia.org/wiki/Thread_%28computer_science%29http://en.wikipedia.org/wiki/Distributed_programminghttp://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29http://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Menlo_Park,_Californiahttp://en.wikipedia.org/wiki/Sand_Hill_Roadhttp://en.wikipedia.org/wiki/James_Goslinghttp://en.wikipedia.org/wiki/NeXThttp://en.wikipedia.org/wiki/Application_programming_interfacehttp://en.wikipedia.org/wiki/Patrick_Naughtonhttp://en.wikipedia.org/wiki/C_%28programming_language%29http://en.wikipedia.org/wiki/Sun_Microsystems8/12/2019 143160095 Java Project Report
12/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 12
By the summer of 1992, they were able to demonstrate portions of the new platform
including the GreenOS,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 namedStar7
that had a graphical interface and a smart agent called "Duketo 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 toPalo Alto, California.
The first person team was interested in building highly interactive devices, and when Time
Warner issued arequest for proposal (RFP) for aset-top box,firstperson changed their target and
responded with a proposal for a set-top box platform. However, thecable industry felt that their
platform gave too much control to the user and firstperson lost their bid toSGI.An additionaldeal 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.
http://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Personal_digital_assistanthttp://en.wikipedia.org/w/index.php?title=Star7&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=Star7&action=edit&redlink=1http://en.wikipedia.org/wiki/Palo_Alto,_Californiahttp://en.wikipedia.org/wiki/Time_Warnerhttp://en.wikipedia.org/wiki/Time_Warnerhttp://en.wikipedia.org/wiki/Request_for_proposalhttp://en.wikipedia.org/wiki/Set-top_boxhttp://en.wikipedia.org/wiki/Cable_TVhttp://en.wikipedia.org/wiki/Silicon_Graphicshttp://en.wikipedia.org/wiki/The_3DO_Companyhttp://en.wikipedia.org/wiki/The_3DO_Companyhttp://en.wikipedia.org/wiki/Silicon_Graphicshttp://en.wikipedia.org/wiki/Cable_TVhttp://en.wikipedia.org/wiki/Set-top_boxhttp://en.wikipedia.org/wiki/Request_for_proposalhttp://en.wikipedia.org/wiki/Time_Warnerhttp://en.wikipedia.org/wiki/Time_Warnerhttp://en.wikipedia.org/wiki/Palo_Alto,_Californiahttp://en.wikipedia.org/w/index.php?title=Star7&action=edit&redlink=1http://en.wikipedia.org/wiki/Personal_digital_assistanthttp://en.wikipedia.org/wiki/Operating_system8/12/2019 143160095 Java Project Report
13/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 13
INTRODUCTION TO JAVA
Java is an object-oriented programming language with a built -in application
programming interface (API) that can handle graphics and u ser interfaces and that can be used
to create applications or applets. Because of its rich set of API's, similar to Macintosh and
Windows, and its platform independence, Java can also be thought of as a platform in itself. Java
also has standard libraries for doing mathematics.
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.
8/12/2019 143160095 Java Project Report
14/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 14
Java Features
Java is simple, easy to design , easy to write, and therefore easy to compile, debug, and learnthan any other programming languages.
Java is object-oriented, that is used to build modular programs and reusable code in otherapplication.
Java is platform-independent and flexible in nature. The most significant feature of Java is torun a program easily from one computer system to another.
Java works on distributed environment. It is designed to work on distributed computing , Anynetwork 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 aresecurable .
Java is robust. Robust means reliability. Java emphasis on checking for possible errors, asJava 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 performseveral 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.
8/12/2019 143160095 Java Project Report
15/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 15
The Simple Types
Java defines eight simple (or elemental) types of data: byte, short, int, long, char, float,double, and boolean.
These can be put in four groups:-
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) ByteThe 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;
8/12/2019 143160095 Java Project Report
16/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 16
b)ShortShort 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.
Here are some examples of short variable declarations:
o short s;o short t;
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 ispromoted to intbefore
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 expressionsthat 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:
8/12/2019 143160095 Java Project Report
17/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 17
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 oftype 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) CharactersThis 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
8/12/2019 143160095 Java Project Report
18/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 18
ranges from 0 to 127 as always, and the extended 8 -bit character set, ISO-Latin-1, ranges from 0
to 255.
Here is a program that demonstrates char variables:
// Demonstrate char data type.
class CharDemo
{
public static void main(Str ing args[])
{
char ch1, ch2;
ch1 = 88; // code for X
ch2 = 'Y';
System.out.print("ch1 and ch2: ");
System.out.println(ch1 + " " + ch2);
}
}
This program displays the following output:
ch1 and ch2: X Y
Notice that ch1 is assigned the value 88, which is the ASCII (and Unicode) value that
corresponds to the letterX.
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.
8/12/2019 143160095 Java Project Report
19/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 19
4) BooleanThis 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
requiredby 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
8/12/2019 143160095 Java Project Report
20/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 20
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 9 displays the value "true."
Type Conversion and Casting
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 arecompatible, 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.
Java's Automatic Conversions
When one type of data is assigned to another type of variable, an automatic type conversion will
take place if the following two conditions are met:
The two types are compatible. The destination type is larger than the source type.
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.
8/12/2019 143160095 Java Project Report
21/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 21
As mentioned earlier, Java also performs an automatic type conversion when storing a
literal integer constant into variables of type byte, short, or long.
Casting Incompatible Types
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.
Forexample, the following fragment casts an int to a byte. If the integer's value is largerthan 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 aninteger 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;
8/12/2019 143160095 Java Project Report
22/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 22
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
8/12/2019 143160095 Java Project Report
23/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 23
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.
public class derived-class-name extendsbase-class-name
{
// derived class methods extend and possibly override
// those of the base class
}
public class class-name implements interface-name
{
// class provides an implementation for the methods
// as specified by the interface
}
8/12/2019 143160095 Java Project Report
24/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 24
Class inheritance
This mechanism of deriving a new class from existing/old class is called inheritance. The old
class is known as base class, superclass or parent class;and the new class is known as
sub class,derived class, or childclass.The inheritance allows subclasses to inherit allproperties (variables and methods) of their parent classes.The different forms of inheritance are:
Single inheritance (only one super class) Multiple inheritance (several super classes) Hierarchical inheritance (one super class, many sub classes) Multi-Level inheritance (derived from a derived class) Hybrid inheritance (more than two types) Multi-path inheritance (inheritance of some properties from two sources).
Abstract Base Classes
An abstract class is a class that leaves one or more method implementations unspecifiedby 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 methodpublic abstract return-type abstract-method-name ( formal-params );
... // other abstract methods, object methods, class methods
}
8/12/2019 143160095 Java Project Report
25/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 25
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 initializationclass Foo
{private int a = 12;
private IDoubleVector b = new DenseDoubVector (2, 0);
private double c;
...
}
Initialized in order of declaration
And initialized before any constructor code is executed
Note: statics only initialized once, at first creation of object of that type
8/12/2019 143160095 Java Project Report
26/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 26
Providing Initialization Code
Can have a block of code that is always run before constructor
class Foo
{
int a;
{
System.out.println (This codell 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?
Calling Super class Constructors
The default (no-param) superclass const. is automatically called
Invoked before anything else is done to the subclass
This can cause a chain of invocations, all the way back to Object
If you want another constructor, use call to super
Must be the first statement in a named constructor
class Foo extends Bar {
{System.out.println (Hi mom!);
}
Foo ()
{
super (2);
8/12/2019 143160095 Java Project Report
27/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 27
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?
To reveal an object's programming interface(functionality of the object) without revealing its
implementation
This is the concept of encapsulation
The implementation can change without affecting the caller of the interface
The caller does not need the implementation at the compile time
It needs only the interface at the compile time During runtime, actual object instance is associated with the interface type.
8/12/2019 143160095 Java Project Report
28/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 28
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.
Captures logical structure of problem May have concurrent interacting components Can handle each component using separate thread Simplifies programming for problem Better utilize hardware resources When a thread is delayed, compute other threads Given extra hardware, compute threads in parallel Reduce overall execution time
Creating Threads in Java
You have to specify the work you want the thread to do Define a class that implements the
Runnable interface
public interface Runnable
{
public void run();
}
Put the work in the run method Create an instance of the worker class and create a thread to run
it or hand the worker instance to an executor
8/12/2019 143160095 Java Project Report
29/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 29
Thread Class
public class Thread
{
public Thread(Runnable R); // Thread R.run()
public Thread(Runnable R, String name);
public void start(); // begin thread execution
...
}
Creating Threads in Java
Runnable interface
Create object implementing Runnable interface Pass it to Thread object via Thread constructor
Examplepublic 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
8/12/2019 143160095 Java Project Report
30/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 30
Alternative (Not Recommended)
Directly extend Thread class
public class MyT extends Thread
{
public void run()
{
// work for thread
}
}
MyT t = new MyT(); // create thread
t.start(); // begin running thread
Java thread can be in one of these states
Newthread allocated & waiting for start() Runnablethread can execute Blockedthread waiting for event (I/O, etc.)
Terminatedthread finished
new
Transitions between states caused by
Invoking methods in class Threadstart(), yield(), sleep() Other (external) events Scheduler, I/O, returning from run()
New Runnable state
Blocked stateTermianted
state
IO,Slee
p,join
IO
COMPLETE,
P EXPIRED
8/12/2019 143160095 Java Project Report
31/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 31
Java swings
What is Swing?
An API for Graphical User Interfaces (GUI)
Created to provide a more sophisticated set of GUI components than the Abstract
Windows Toolkit (AWT)
Part of the Java Foundation Classes (JFC)
Lightweight components because they lookconsistent on platforms
GUI application tasks:
Call constructor of the JFrame superclass.
Get an object reference to the content panecontainer GUI objects are added to this pane
Set the layout manager to arrange GUI components in the window
Instantiate each component
Add each component to the content pane
Set the window size
Display the window
Swing Components:
JLabel displays an image or readonly text
JTextField singleline text box for input
JTextArea multiple line text box
JPasswordField single line for accepting passwords butnot displaying what is typed
JButton command button
JRadioButton toggle one in a group
JCheckBox user selects 0, 1, or more options in a group
JList list of items to select 1 or more
JComboBox dropdown list to select one item
8/12/2019 143160095 Java Project Report
32/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 32
Event Handling
GUIs are eventdrivenuser choose to act and the GUI responds via an event handler
To program for this we need to:
Write a listener (event handler)
Instantiate an object of that class
Register the listener on 1 or more components
What fires?
JTextField and JTextAreapressing enter; event object =ActionEvent
JButtonpressing the button; event object = ActionEvent
JRadioButton, JCheckBox, JComboBoxmaking a choice; event object = ItemEvent
JListselecting an item; event object = ListSelectionEvent
Any componentmouseup or mousedown or moving the mouse; event object = MouseEvent
Dialog Boxes in Swing
JDialogis directly descended from the Dialogclass
JDialogcontains a rootPane hierarchy including a contentPane
All dialogs are modal, which means thecurrent thread is blocked until user interaction with it
has been completed.
Types of Dialog Boxes
JOptionPane.showMessageDialog reports something that has happened to the user
JOptionPane.showConfirmDialogasks for a confirming response e.g. yes, no, cancel
JOptionPane.showInputDialog prompt the user for input
8/12/2019 143160095 Java Project Report
33/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 33
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.
DATA FLOW DIAGRAMS
Madame
managment
Home
page
Login
page
billStaff
Information
Invent
oryCustome
r detail
8/12/2019 143160095 Java Project Report
34/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 34
DATABASES
E
registratio
n
Inventory
S_id
name
available
required
F name
size
E id
Mobile
date
Email id
city
address
L nameC_id
name
phone
address
price
Work
experience
E mail id
address
P_no
Customer Staff
information
User
8/12/2019 143160095 Java Project Report
35/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 35
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.
8/12/2019 143160095 Java Project Report
36/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 36
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.
8/12/2019 143160095 Java Project Report
37/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 37
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 .
8/12/2019 143160095 Java Project Report
38/39
Roll No.s:-90080302449, 90080302458, 90080302476,
[Type text] Page 38
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.
8/12/2019 143160095 Java Project Report
39/39
Roll No.s:-90080302449, 90080302458, 90080302476,