0% found this document useful (0 votes)
22 views

Showroom management project

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

Showroom management project

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

A Project report On

Showroom Management
BACHELOR OF COMPUTER
APPLICATION(BCA)
Session:2022-25

Submited by
Komal Yadav(22015003312)

Razia Parveen(2201500356)

Mahima Sharma(22015003319)

Anjali Rajput(22015003260)

Under Guidance Of

MR.ANKIT GUPTA MR.BRIJENDRA SHUKLA


(Technical Trainer) (BCA Academic Head)

College of Management Studies Unnao


@RAGENDRA SWARUP KNOWLEDGE CITY UNNAO
(Affiliated to Chhatrapati Shahu Ji Maharaj University, Kanpur Nagar)
Kanpur –Lucknow National Highway
CERTIFICATE
CSJMU

Bachelor Of Computer Applications BCA 5thsem

Session: 2022 -2025

This is to certify that this report entitled “Showroom


Management”

The original work done by student Komal Yadav(22015003312), Razia


Parveen(2201500356),Mahima Sharma(22015003319), Anjali
Rajput(22015003260) of BCA V

Session 2022 -2025 in in partia fulfillment

Of her course requirement at CSJMU.

Supervisor Name: Dr. Ashutosh Mishra

Designation: Principal
ACKNOWLEDGEMENT

I thank the Almighty for providing me the opportunity and giving me the
strength to just hang in there and final the job.

I express my gratitude to Mr. Brajendra Shukla (Head of Department of BCA),

And

Mr. Ankit Gupta(Technical Trainer) ) for his support of guidance and valuable
suggestion at the making every stage of this project. His broad knowledge about
JAVA leads me to complete this project and also permitted us to perform this
project and organized everything including the permission for computer
resources.

I would like to express my sincere thanks to Mr. Brajendra Shukla and Mr. Ankit
Guptar who help me to complete this valuable task.

I would also like to thank my family, for encouraging me a lot to complete my


project successfully within time. Moreover, my family has put up with my absence
for more evenings than I like to think while I finished this project

ABSTRACT

This is a project report on “showroom 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 “showroom 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.

PREFACE

Learning comes from doing. To learn something one has to go through


Practical conditions. Recognizing this fact, the University has made it
essential forBCA 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 “showroom


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.
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 32-37
• Data Flow Diagrams
• Screen Shots
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
Australia with 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
customer’s 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 customer’s online
business. Our Research & Development arm offers SEO tools for SEM
professionals.
PROJECT DESCRIPTION

This is an Showroom Management project. 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. 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.

COMPONENTS OF THE PROJECT

• How to Login

• In this module, the user will enter his username and password to goto home page.

• 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.

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

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 Sun Microsystems. It is used to develop console and
graphical HYPERLINK
"http://en.wikipedia.org/wiki/Graphical_user_interface"
HYPERLINK
"http://en.wikipedia.org/wiki/Graphical_user_interface"
HYPERLINK
"http://en.wikipedia.org/wiki/Graphical_user_interface"user
HYPERLINK
"http://en.wikipedia.org/wiki/Graphical_user_interface"
HYPERLINK
"http://en.wikipedia.org/wiki/Graphical_user_interface"
HYPERLINK
"http://en.wikipedia.org/wiki/Graphical_user_interface"interface
HYPERLINK
"http://en.wikipedia.org/wiki/Graphical_user_interface"
HYPERLINK "http://en.wikipedia.org/wiki/Application_software"
HYPERLINK
"http://en.wikipedia.org/wiki/Graphical_user_interface"application
s HYPERLINK
"http://en.wikipedia.org/wiki/Application_software" 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).

HISTORY

The Java platform and language began as an internal project


at Sun HYPERLINK "http://en.wikipedia.org/wiki/Sun_Microsystems"
HYPERLINK "http://en.wikipedia.org/wiki/Sun_Microsystems"
HYPERLINK
"http://en.wikipedia.org/wiki/Sun_Microsystems"Microsystems
HYPERLINK "http://en.wikipedia.org/wiki/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
HYPERLINK "http://en.wikipedia.org/wiki/Embedded_system" 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.
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
HYPERLINK "http://en.wikipedia.org/wiki/Time_Warner" issued a
request for HYPERLINK
"http://en.wikipedia.org/wiki/Request_for_proposal" HYPERLINK
"http://en.wikipedia.org/wiki/Request_for_proposal" HYPERLINK
"http://en.wikipedia.org/wiki/Request_for_proposal"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.

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.

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.

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:-

• 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:
• 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;

• 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.

Here are some examples of short variable declarations:


• short s;
• short t;

• 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.

• 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.
.
• 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:

• 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.


ouble

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,
approxi
mately a
= pi * r *
r; //
compute
area
System.out.println("Area of circle is " + a);}}

• 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
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:


//
D
e
m
o
n
s
t
r
a
t
e
c
h
a
r
d
a
t
a
t
y
p
e
.
c
l
a
s
s
C
h
a
r
D
e
m
o
{
public static void main(Str ing args[])
{
char ch1, ch2;
c
h
1
=
8
8
;
/
/
c
o
d
e
f
o
r
X
c
h
2
=
'
Y
'
;
System.out.print("ch
1 and ch2: ");
System.out.println(c
h1 + " " + 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 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.

• 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:
//
Demonst
rate
boolean
values.
class
BoolTest
{
public static void main(String args[])
{
b
o
o
l
e
a
n
b
;
b
=
f
a
l
s
e
;
System.
out.print
ln("b is
" + b); b
= true;
System.out.println("b is " + b);
// a boolean value can
control the if
statement if(b)
System.out.println("T
his 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
T
h
i
s
i
s
e
x
e
c
u
t
e
d
.
1
0
>
9
i
s
t
r
u
e

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."

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 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.

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.

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.

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.
i
n
t
a
;
b
y
t
e
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:
//
D
e
m
o
n
s
t
r
a
t
e
c
a
s
t
s
.
c
l
a
s
s
C
o
n
v
e
r
s
i
o
n
{
public static
void main(String
args []) { byte b;

int i = 257;
double d = 323.142;
System.out.println("\\nConv
ersion of int to byte."); b =
(byte) i;
System.out.println("i and b "
+ i + " " + b);
System.out.println("\\nConver
sion of double to int."); i =
(int) d;
System.out.println("d and i " + d
+ " " + i);
System.out.println("\\nConversi
on 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.14
2 323
Conver
sion of
double
to
byte. d
and b
323.14
2 67

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:

lass 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.

nterface 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 extends base-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
}

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.

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 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
}

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


t object allocation
— Java assigns each member var its default value

f you want, you can give an explicit
initialization class 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

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 ();

hat 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


nvoked before anything else is done to the subclass

his can cause a chain of invocations, all the way back to ―Object‖

f you want another constructor, use call to ―super‖

ust be the first statement in a named
constructor class Foo extends Bar {
{
System.out.println (―Hi mom!‖);
}
Foo ()
{
super (2);

System.out.println (―Here is the constructor.‖);


}
} ...
Foo bar = new Foo ();

Interface


t defines a standard and public way of specifying the behavior of classes

efines a contract

ll methods of an interface are abstract methods

efines the signatures of a set of methods, without the body (implementation of the methods)

concrete class must implement the interface (all the abstract methods of the Interface)

t 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

his is the concept of encapsulation

he implementation can change without affecting the caller of the interface

he 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.

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

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

• 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

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

• New – thread allocated & waiting for start()


• Runnable – thread can execute
• Blocked – thread waiting for event (I/O, etc.)
• Terminated – thread finished

Transitions between states caused by


• Invoking methods in class Threadstart(), yield(), sleep()
• Other (external) events Scheduler, I/O, returning from run()…

Java swings

What is Swing?


n API for Graphical User Interfaces (GUI)

reated to provide a more sophisticated set of GUI components than the Abstract
Windows Toolkit (AWT)

art of the Java Foundation Classes (JFC)

ightweight components because they lookconsistent on platforms

GUI application tasks:


all constructor of the JFrame superclass.

et an object reference to the content pane container - GUI objects are added to this pane

et the layout manager to arrange GUI components in the window

nstantiate each component

dd each component to the content pane

et the window size

isplay the window
Swing Components:

Label displays an image or read-only text

TextField single-line text box for input

TextArea multiple line text box

PasswordField single line for accepting passwords but not displaying what is typed

Button command button

RadioButton toggle one in a group

CheckBox user selects 0, 1, or more options in a group

List list of items to select 1 or more

ComboBox dropdown list to select one item

Event Handling

• GUIs are event-driven – user choose to act and the GUI responds via an
event handler To program for this we need to:

rite a listener (event handler)

nstantiate an object of that class

egister the listener on 1 or more components

What fires?


TextField and JTextArea – pressing enter; event object =ActionEvent

Button – pressing the button; event object = ActionEvent

RadioButton, JCheckBox, JComboBox – making a choice; event object = ItemEvent

List – selecting an item; event object = ListSelectionEvent

ny component – mouseup or mousedown or moving the mouse; event object = MouseEvent

Dialog Boxes in Swing


Dialog is directly descended from the Dialogclass

Dialog contains a rootPane hierarchy including a contentPane

ll dialogs are modal, which means the current thread is blocked until user interaction
with it has been completed.
Types of Dialog Boxes


OptionPane.showMessageDialog – reports something that has happened to the user

OptionPane.showConfirmDialog – asks for a confirming response e.g. yes, no, cancel

OptionPane.showInputDialog – prompt the user for input

Showroom 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


DATABASES

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.

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.
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 .
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.
BIBLIOGRAPHY

1. Under Guidance of Ankit Sir from Lakshya IT Solutions (Technical


Trainer)

2. W3 School
3. Java T Point
4. Git Hub

You might also like