Java PBL
Java PBL
Mr. K. Praveen
Assistant Professor
Dept. of Computer Applications
ACKNOWLEDGEMENT
We wish to express our gratitude to project guide Mr. K. Praveen, for his valuable
supervisionand timely assistance in regard to our project work.
We would like to thank C.A Department for providing us this opportunity to share and
contribute our part of the work to accomplish the project in time, and all the teaching and
supporting staff for their steadfast support and encouragement
The satisfaction that accompanies the successful completion of any task would be
incomplete without the mention of my family members and friends, who made it possible
and whose encouragement and guidance have been a source of our inspiration.
DECLARATION
We hereby declare that the project entitled “ONLINE E-COMMERCE USING APPLET”
submitted to the Anurag University in partial fulfillment of the requirements for the award of
the degree of B.E. in IT is a bonafide and original work done by us under the guidance of Mr.
K. Praveen, Associate Professor, Computer Applications and this project work have not been
submitted to any other university for the award of any degree or diploma.
D. Anudeep 23MC201B18
K. S. Bharath Raj 23MC201B46
N. Vaishnavi 23MC201B62
ABSTRACT
The "KaboomApplet" is a Java applet designed for interactive shopping of alcoholic beverages.
Implemented using Java's AWT, it features a user interface with customer detail entry, beverage
category selections (beer, wine, whiskey), and cart management functionalities. Users can add
items to their cart, remove selections, and make payments, with real-time updates of order
summaries and total amounts. The applet demonstrates effective GUI design and integration of
Java programming for creating engaging web-based shopping experiences.
INDEX
S.NO CONTENTS PG.NO
1. Introduction 1
1.1 Objective
1.2 Purpose & Scope
2. Literature Review 2
3. Requirements &System Analysis 3-4
3.1 Existing System
3.2 Proposed System
3.3 Software Requirements
3.4 Hardware Requirements
4. Implementation & Code 5 - 15
5. Testing Approach 16 - 17
6. Results 18 - 19
6.1 Home Screen
6.2 Customer Details
6.3 Payment Successful
7. Conclusion & Future Scope 20
7.1 Future Scope
8. References 21
1. INTRODUCTION
The "KaboomApplet" is a Java-based web application designed to facilitate the online purchase
of alcoholic beverages through a graphical user interface (GUI). It utilizes Java's Abstract
Window Toolkit (AWT) for creating an interactive environment accessible via web browsers.
This introduction outlines the objectives, purpose, and scope of the project, highlighting its
significance in enhancing user experience and facilitating e-commerce in the beverage industry.
1.1 OBJECTIVE:
The primary objective of the KaboomApplet is to provide a seamless and efficient platform for
users to browse, select, and purchase alcoholic beverages online. By leveraging Java's AWT
capabilities, the applet aims to enhance user engagement through intuitive interface design and
real-time transaction updates. It seeks to streamline the shopping process, ensuring
convenience and accessibility for consumers interested in beer, wine, and whiskey selections.
Real-time Updates: Providing dynamic updates of the shopping cart contents and total
amount due as items are added or removed.
Secure Payment Processing: Implementing secure payment gateways to ensure
confidentiality and integrity of financial transactions.
Order Confirmation and Delivery: Generating order confirmations, estimating
delivery dates, and providing status updates to customers.
The KaboomApplet aims to enhance customer satisfaction by offering a seamless and secure
online shopping experience tailored to the unique requirements of purchasing alcoholic
beverages.
1
2. LITERATURE REVIEW
The development of web-based applications for e-commerce, particularly in specialized
markets such as alcoholic beverages, has been a subject of significant research and
development. Existing literature emphasizes several key aspects that are crucial for the success
of such applications:
User Interface Design: Effective use of GUI frameworks like Java's AWT and Swing
for creating intuitive and responsive interfaces that enhance user interaction and
satisfaction.
Security Considerations: Ensuring robust security measures in payment processing,
including SSL encryption, to protect sensitive customer data and prevent unauthorized
access.
The literature review underscores the importance of integrating these factors into the design
and implementation of e-commerce applications like the KaboomApplet to ensure reliability,
security, and compliance with industry standards.
2
3. REQUIREMENTS & SYSTEM ANALYSIS
3.1 EXISTING SYSTEM:
Current online platforms for purchasing alcoholic beverages vary widely in terms of
functionality, user interface design, and security measures. Many existing systems may lack
intuitive interfaces, real-time updates on cart contents, or comprehensive security protocols for
payment processing. Issues related to data management and regulatory compliance also pose
challenges in ensuring a seamless and secure shopping experience for consumers.
Intuitive User Interface: Designed using Java's AWT, the applet provides a visually
appealing and easy-to-navigate interface for users to browse and select products
effortlessly.
Dynamic Product Selection: Users can browse through categorized sections (beer, wine,
whiskey), view detailed product descriptions, and add items to their cart with a single
click.
Real-time Updates and Notifications: The applet updates the shopping cart in real-time,
reflecting changes in selected items and calculating the total amount due instantly.
Java Development Kit (JDK): Required for development and compilation of Java
programs.
Integrated Development Environment (IDE): Tools such as IntelliJ IDEA or Eclipse
for coding, debugging, and managing project files.
AWT and Swing Libraries: Used for creating graphical user interfaces and handling
user interactions effectively.
3
Web Server: Deployment on servers like Apache Tomcat for hosting the applet and
handling client-server communication.
Secure Socket Layer (SSL): Implementation for secure communication over the
internet, ensuring encrypted data transmission during payment transactions.
Sufficient RAM and Processing Power: Adequate resources to handle concurrent user
sessions and database operations without performance degradation.
Internet Connectivity: Essential for accessing the applet through a web browser and
facilitating online transactions seamlessly.
These requirements ensure that the KaboomApplet operates efficiently, meets user expectations
for performance and security, and complies with industry standards and regulations governing
online sales of alcoholic beverages.
4
4. IMPLEMENTATION & CODE
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.Calendar;
private String[] beerItems = {"Kingfisher: $2", "Budweiser: $3", "Heineken: $4", "Corona:
$5", "Bira: $6"};
private String[] wineItems = {"Barefoot Cellars: $10", "Grover: $11", "Fratelli: $12",
"York: $13", "KRSMA: $14"};
private String[] whiskeyItems = {"Royal Stag: $8", "McDowell's: $9", "Blenders Pride:
$10", "Jack Daniels: $50", "Chivas Regal: $60"};
setLayout(null);
setBackground(Color.ORANGE);
5
title.setFont(new Font("Serif", Font.BOLD, 36));
title.setBounds(400, 10, 400, 50);
add(title);
add(customerDetailsLabel);
add(nameLabel);
nameField = new TextField();
add(genderLabel);
genderChoice = new Choice();
genderChoice.add("Male");
genderChoice.add("Female");
genderChoice.setBounds(250, 160, 200, 30);
add(genderChoice);
6
ageLabel.setFont(new Font("Serif", Font.BOLD, 16));
ageLabel.setBounds(50, 200, 200, 30);
add(ageLabel);
ageField = new TextField();
add(addressLabel);
addressField = new TextField();
addressField.setBounds(250, 240, 200, 30);
add(addressField);
addToCartButton.setBackground(Color.cyan);
addToCartButton.setBounds(50, 300, 200, 40);
addToCartButton.addActionListener(this);
add(addToCartButton);
removeFromCartButton.setBackground(Color.cyan);
removeFromCartButton.setBounds(50, 350, 200, 40);
removeFromCartButton.addActionListener(this);
add(removeFromCartButton);
7
makePaymentButton = new Button("Make Payment");
makePaymentButton.setFont(new Font("Serif", Font.BOLD, 16));
makePaymentButton.setBackground(Color.cyan);
makePaymentButton.setBounds(50, 400, 200, 40);
makePaymentButton.addActionListener(this);
add(makePaymentButton);
// Beer section
beerButtons[i].setBackground(Color.cyan);
beerButtons[i].addActionListener(this);
add(beerButtons[i]);
}
// Wine section
Label wineSectionLabel = new Label("Wine Section", Label.CENTER);
8
// Create buttons for wines
wineButtons[i].addActionListener(this);
add(wineButtons[i]);
// Whiskey section
whiskeyButtons[i].setBackground(Color.cyan);
whiskeyButtons[i].addActionListener(this);
add(whiskeyButtons[i]);
}
9
Label orderSummaryLabel = new Label("Order Summary", Label.CENTER);
orderSummaryLabel.setFont(new Font("Serif", Font.BOLD, 18));
add(orderSummary);
add(removeItemChoice);
}
if (e.getSource() == addToCartButton) {
for (Button btn : beerButtons) {
if (btn.getBackground() == Color.GREEN) {
cartItems.add(btn.getLabel());
totalAmount += Double.parseDouble(btn.getLabel().split("\\$")[1]);
removeItemChoice.add(btn.getLabel());
btn.setBackground(Color.cyan);
10
}
}
cartItems.add(btn.getLabel());
totalAmount += Double.parseDouble(btn.getLabel().split("\\$")[1]);
removeItemChoice.add(btn.getLabel());
btn.setBackground(Color.cyan);
}
}
totalAmount += Double.parseDouble(btn.getLabel().split("\\$")[1]);
removeItemChoice.add(btn.getLabel());
btn.setBackground(Color.cyan);
}
}
updateOrderSummary();
removeItemChoice.remove(selectedItem);
updateOrderSummary();
}
} else if (e.getSource() == makePaymentButton) {
if (validateCustomerDetails()) {
11
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MINUTE, 40); // Set delivery date to three days from now
}
} else {
toggleButtonSelection(btn);
}
}
for (Button btn : wineButtons) {
if (e.getSource() == btn) {
toggleButtonSelection(btn);
}
}
for (Button btn : whiskeyButtons) {
if (e.getSource() == btn) {
toggleButtonSelection(btn);
}
}
}
}
btn.setBackground(Color.GREEN);
} else {
12
btn.setBackground(Color.cyan);
}
}
orderSummary.append("Total Amount: $" + totalAmount + "\n");
try {
age = Integer.parseInt(ageStr);
} catch (NumberFormatException e) {
13
return true;
dialog.dispose();
clearCustomerDetails();
}
});
dialog.add(label);
dialog.add(okButton);
dialog.setSize(800, 250);
dialog.setVisible(true);
}
nameField.setText("");
ageField.setText("");
addressField.setText("");
14
genderChoice.select(0);
cartItems.clear();
totalAmount = 0;
removeItemChoice.removeAll();
updateOrderSummary();
}
HTML FILE:
<!DOCTYPE html>
<html>
<head>
<title>KABOOM Applet</title>
</head>
</center>
</body>
</html>
15
5. TESTING APPROACH
Software testing is a process used to identify the correctness, completeness, and quality of
developed computer software. It includes a set of activities conducted with the intent of
findingerrors in software so that they can be corrected before the product is released to the
end users. In other words, software testing is an activity to check that the software system is
defect-free. Software testing is primarily a broad process that is composed of several
interlinked processes. The primary objective of software testing is to measure software
health along with its completeness in terms of core requirements. Software testing involves
examining and checkingsoftware through different testing processes. The objectives of these
processes can include:
If there is any error then it must be removed before delivery of the project. Type of Testing
Fordetermining errors various types of test actions are performed: -
Unit testing: - Unit testing focuses verification effort on the smallest unit of software design
– the module. Using the detailed design description as a guide, important control paths are
testedto uncover errors within the boundary of the module. The relative complexity of tests
and the errors detected as a result is limited by the constrained scope established for unit
testing. The unit test is always white box oriented, and the step can be conducted in parallel
for multiple modules. Unit testing is normally considered an adjunct to the coding step. After
source-level code has been developed, reviewed, and verified for correct syntax, unit test case
design begins.
Integration Testing - A level of the software testing process where individual units are
combined and tested as a group. The purpose of this level of testing is to expose faults in the
interaction between integrated units.
16
elements of the system, conduct a series of tests that simulate bad data or other potential
errors at the software interface, record the results or tests to use as “evidence” if finger
pointing does occur, participate in the planning and design of system test to ensure that
software is adequately tested.
There are many types of system tests that are worthwhile for software-based systems: -
17
6. RESULTS
6.1 HOME SCREEN:
18
6.3 PAYMENT SUCCESSFUL:
19
7. CONCLUSION & FUTURE SCOPE
The development of the "KaboomApplet" marks a significant advancement in the realm of
online shopping for alcoholic beverages. Leveraging Java's AWT for its user interface, the
applet offers a seamless and interactive platform that enhances user experience through
intuitive design and robust functionalities. By addressing key challenges such as secure
payment processing, real-time updates of shopping carts, and compliance with regulatory
requirements, the KaboomApplet ensures reliability and trustworthiness for consumers.
The applet's successful implementation demonstrates its capability to streamline the purchasing
process, making it convenient and accessible for customers to browse, select, and manage their
orders. Through effective integration of software and hardware resources, it meets the needs of
both consumers and administrators involved in the online sale of alcoholic beverages.
Mobile Compatibility: Adaptation of the applet for mobile platforms (iOS and Android)
to reach a broader audience and facilitate on-the-go shopping.
20
8. REFERENCES
For further exploration and learning, interested individuals can refer to a variety of resources
such as:
Java AWT Documentation:
https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/package-
summary.html
Java Event Handling:
https://docs.oracle.com/javase/tutorial/uiswing/events/index.html
Introduction to Java Applets:
https://docs.oracle.com/javase/tutorial/deployment/applet/
Java GUI Programming:
https://docs.oracle.com/javase/tutorial/uiswing/index.html
These links provide comprehensive information on Java AWT, event handling, Java applet
deployment, and GUI programming using Swing, which are relevant to the development of the
"KABOOM" applet.
21