0% found this document useful (0 votes)
15 views20 pages

AJP Report2

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)
15 views20 pages

AJP Report2

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/ 20

Annexure – I

Micro-Project Proposal

Online Auction Website

1.0 Aim/ Benefits of the Micro-Project


This Micro-Project aims at
1. Develop and enhance Java programming skills by applying core concepts in a real-world
scenario.
2. Create an Online Auction Website to simulate auction functionalities, allowing users to place
bids on various items.

2.0 Course Outcomes Addressed


a) Develop programs using GUI Framework (AWT and Swing) [✔]
b) Handle events of AWT and swing components [✔]
c) Develop programs to handle events in java programming [✔]
d) Develop java programs using network concepts [ ]
e) Develop programs using database [ ]
f) Develop programs using servlets [ ]

3.0 Proposed Methodology


⮚ Discussion about topic with guide and among group members

⮚ Program survey

⮚ Submission of project proposal

⮚ Information collection and Analysis

⮚ Discussing about concepts to be used and taken into consideration

⮚ Writing algorithm

⮚ Preparing flowchart

⮚ Coding

⮚ Compilation of the code

⮚ Representation

⮚ Editing and revising the content

⮚ Report preparation

1
4.0 Action Plan
SR. Details of activity Planned Start Planned Name of Responsible
No. date Finish date Team Members

1 Finalization of Project Title and 22/07/24 29/07/24 All Members


Scope
2 Project Definition and design 29/07/24 07/08/24 All Members
structure
3 Design procedure (Algorithm / 07/08/24 21/08/24 All Members
Flowchart)

4 Coding 21/08/24 04/09/24 All Members

5 Coding 04/09/24 18/09/24 All Members

6 Editing and Testing of Program 18/09/24 09/10/24 All Members

7 Report writing 09/10/24 14/10/24 All Members

8 14/10/24 16/10/24 All Members


Demonstration of project and final
submission

5.0 Resources Required


Sr. No. Equipment Name with Broad Specification Remark if
any

1. Desktop pc – Windows 10

2. Editor used – Visual Studio Code

3. Software – JDK 1.8

Name of Team Members with Roll Nos.


1) Pranjal Nirmal – 70
2) Riya Negi - 71

Mrs. Pratibha Pednekar __________________


Name and Signature of Course Teacher

2
Annexure – II

Micro-Project Report

Online Auction Website

1.0 Rationale
The Online Auction Website project is designed to provide a platform where users can engage in real-
time auctions, offering a convenient and efficient way to buy and sell products. This project combines
web development with Java programming, giving students practical experience in creating dynamic,
interactive websites. The rationale behind developing this project is to:
1. Simulate the auction process, fostering a better understanding of e-commerce transactions.
2. Provide a hands-on approach to learning Java programming and web integration.
3. Explore the concepts of user authentication, bidding mechanisms, and real-time data updates.
4. Enhance problem-solving skills by addressing challenges like concurrency, data management,
and security.

2.0 Aim of the Micro-Project


This Micro-Project aims at
1. Develop and enhance Java programming skills by applying core concepts in a real-world
scenario.
2. Create an Online Auction Website to simulate auction functionalities, allowing users to place
bids on various items.

3.0 Course Outcomes Addressed


a) Develop programs using GUI Framework (AWT and Swing) [✔]
b) Handle events of AWT and swing components [✔]
c) Develop programs to handle events in java programming [✔]
d) Develop java programs using network concepts [ ]
e) Develop programs using database [ ]
f) Develop programs using servlets [ ]

3
4.0 Literature Review

Graphical User Interfaces (GUIs) and server-server socket communication are integral to
creating interactive and network-based software systems. In this context, GUIs are designed
to provide an accessible and user-friendly interface, while server-server socket communication
ensures real-time data transfer between the client and server, enabling dynamic, responsive
applications.

1. Graphical User Interfaces (GUIs)

GUIs offer an intuitive way for users to interact with software by representing functions
through visual elements like buttons, labels, tables, and forms. Java Swing is one of the most
widely used libraries for building GUIs in Java applications. It provides a range of components
that make it easy to design responsive and interactive interfaces for desktop applications.

For instance, in your application, the use of JFrame, JTextField, JButton, JLabel, and JTable
provides a structured and organized way to input and display data for auction items, bids, and
auction results. The GUI ensures that the administrator can add items, manage auctions, and
visualize data in a clean, accessible format. For the client, the GUI facilitates interaction with
the bidding system by allowing users to place bids, view item details, and monitor the auction's
progress.

2. Server-Server Socket Communication

Server-socket communication is essential for enabling real-time interaction between the client
and server applications over a network. Java provides an efficient Socket and ServerSocket
API for building networked applications that can exchange data over the Transmission Control
Protocol (TCP). TCP ensures that data packets are delivered in order and without error, making
it an ideal choice for auction systems, where accurate and timely data exchange is critical.

In your application, the server listens for client connections on a specified port using
ServerSocket. Once a connection is established, Socket is used to facilitate communication
between the server and client. The server receives bid information from clients, processes it,
and sends relevant updates back to ensure synchronization between all connected clients. This
real-time exchange enables an efficient auction system where bids can be placed, and results
can be displayed dynamically, ensuring a seamless experience for users.

4
5.0 Actual Procedure Followed

ALGORITHM:

Step 1: Start.
Step 2: Admin enters the item name, price, and selects an image.
Step 3: Admin presses "Add Item" or "Close".
Step 4:
If Add Item is pressed, the item will be added to the auction table.
If Close is pressed, the current window will close.
Step 5: Admin presses "Start Auction".
Step 6: The timer starts for a 1-minute countdown and the item details are displayed on the client
panel.
Step 7: Client enters their name and bid price.
Step 8: Client presses "Place Bid".
Step 9: If bid details are valid, the bid is submitted and shown in the auction table on the admin
panel.
Step 10: Once the timer ends, the system checks all bids.
Step 11: The system declares the highest bid as the winner.
Step 12: The auction ends and results are displayed.
Step 13: Admin can close the auction or restart.
Step 14: Stop.

5
FLOWCHART:

6
Code
1) Server.java
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Server extends JFrame {

private JTextField itemNameField, priceField;


private JButton selectImageButton, addItemButton, startAuctionButton, closeButton;
private JLabel timerLabel;
private JTable auctionTable;
private DefaultTableModel tableModel;
private Timer auctionTimer;
private int timeLeft = 60; // 1 minute countdown

public Server() {
// Set frame properties
setTitle("Admin Panel");
setSize(600, 400);
setLayout(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// Item Name Label and Field


JLabel itemNameLabel = new JLabel("ITEM NAME:");
itemNameLabel.setBounds(20, 20, 100, 30);
add(itemNameLabel);

itemNameField = new JTextField();


itemNameField.setBounds(120, 20, 150, 30);
add(itemNameField);

// Price Label and Field


JLabel priceLabel = new JLabel("PRICE:");
priceLabel.setBounds(20, 60, 100, 30);
add(priceLabel);

priceField = new JTextField();


priceField.setBounds(120, 60, 150, 30);
add(priceField);

7
// Select Image Button
selectImageButton = new JButton("SELECT IMAGE");
selectImageButton.setBounds(120, 100, 150, 30);
add(selectImageButton);

// Timer label
timerLabel = new JLabel("TIMER: 01:00");
timerLabel.setBounds(400, 20, 150, 30);
timerLabel.setFont(new Font("Arial", Font.BOLD, 14));
add(timerLabel);

// Table to show auction items


String[] columnNames = {"ITEM_NAME", "IMAGE", "PRICE", "BIDDER_NAME",
"BID_AMOUNT", "SOLD_AT"};
tableModel = new DefaultTableModel(columnNames, 0);
auctionTable = new JTable(tableModel);
JScrollPane tableScrollPane = new JScrollPane(auctionTable);
tableScrollPane.setBounds(20, 150, 550, 150);
add(tableScrollPane);

// Add Item Button


addItemButton = new JButton("ADD ITEM");
addItemButton.setBounds(20, 320, 100, 30);
add(addItemButton);

// Start Auction Button


startAuctionButton = new JButton("START AUCTION");
startAuctionButton.setBounds(460, 320, 150, 30);
add(startAuctionButton);

// Close Button
closeButton = new JButton("CLOSE");
closeButton.setBounds(340, 320, 100, 30);
add(closeButton);

// Add Action Listeners


addItemButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addItem();
}
});

8
startAuctionButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
startAuction();
}
});

closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
closeAuction();
}
});
}

// Method to add item to the table


private void addItem() {
String itemName = itemNameField.getText();
String price = priceField.getText();
String image = "Image";

if (!itemName.isEmpty() && !price.isEmpty()) {


tableModel.addRow(new Object[]{itemName, image, price, "", "", ""});
itemNameField.setText("");
priceField.setText("");
} else {
JOptionPane.showMessageDialog(this, "Please fill in both item name and price.", "Error",
JOptionPane.ERROR_MESSAGE);
}
}

// Method to start the auction


private void startAuction() {
startAuctionButton.setEnabled(false);
auctionTimer = new Timer(1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
timeLeft--;
updateTimer();
if (timeLeft == 0) {
auctionTimer.stop();
declareWinner();
}

9
}
});
auctionTimer.start();
}

// Method to update the timer label


private void updateTimer() {
int minutes = timeLeft / 60;
int seconds = timeLeft % 60;
timerLabel.setText(String.format("TIMER: %02d:%02d", minutes, seconds));
}

// Method to declare the winner


private void declareWinner() {
int rowCount = tableModel.getRowCount();
double highestBid = -1;
String winner = null;
String itemSoldAt = null;

for (int i = 0; i < rowCount; i++) {


String bidderName = (String) tableModel.getValueAt(i, 3);
String bidAmountStr = (String) tableModel.getValueAt(i, 4);

if (!bidderName.isEmpty() && bidAmountStr != null && !bidAmountStr.isEmpty()) {


double bidAmount = Double.parseDouble(bidAmountStr);
if (bidAmount > highestBid) {
highestBid = bidAmount;
winner = bidderName;
itemSoldAt = (String) tableModel.getValueAt(i, 0);
}
}
}

if (winner != null) {
JOptionPane.showMessageDialog(this, "The winner is " + winner + " with a bid of $" +
highestBid + " for " + itemSoldAt, "Auction Result", JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(this, "No bids were placed.", "Auction Result",
JOptionPane.INFORMATION_MESSAGE);
}
}

// Method to close the auction window

10
private void closeAuction() {
System.exit(0);
}

public static void main(String[] args) {


SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new Server().setVisible(true);
}
});
}
}

2) Client.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.net.Socket;

public class Client extends JFrame {

private JTextField bidderNameField, bidPriceField;


private JLabel timerLabel, itemNameLabel, priceLabel, imageLabel;
private JButton addBidButton, closeButton;
private Socket socket;
private PrintWriter out;
private BufferedReader in;
private Timer auctionTimer;
private int timeLeft = 60; // 1-minute countdown for synchronization with server

public Client() {
// Set frame properties
setTitle("Customer Panel");
setSize(600, 400);
setLayout(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// Bidder Name Label and Field

11
JLabel bidderNameLabel = new JLabel("BIDDER NAME:");
bidderNameLabel.setBounds(20, 20, 100, 30);
add(bidderNameLabel);

bidderNameField = new JTextField();


bidderNameField.setBounds(120, 20, 150, 30);
add(bidderNameField);

// Bid Price Label and Field


JLabel bidPriceLabel = new JLabel("BID PRICE:");
bidPriceLabel.setBounds(20, 60, 100, 30);
add(bidPriceLabel);

bidPriceField = new JTextField();


bidPriceField.setBounds(120, 60, 150, 30);
add(bidPriceField);

// Timer label
timerLabel = new JLabel("TIMER: AUCTION NOT STARTED!");
timerLabel.setBounds(400, 20, 200, 30);
timerLabel.setFont(new Font("Arial", Font.BOLD, 14));
add(timerLabel);

// Item details
itemNameLabel = new JLabel("ITEM NAME:");
itemNameLabel.setBounds(320, 60, 100, 30);
add(itemNameLabel);

priceLabel = new JLabel("PRICE:");


priceLabel.setBounds(320, 100, 100, 30);
add(priceLabel);

imageLabel = new JLabel("IMAGE:");


imageLabel.setBounds(320, 140, 100, 30);
add(imageLabel);

// Add Bid Button


addBidButton = new JButton("ADD BID");
addBidButton.setBounds(20, 320, 100, 30);
add(addBidButton);

12
// Close Button
closeButton = new JButton("CLOSE");
closeButton.setBounds(460, 320, 100, 30);
add(closeButton);

// Action listeners
addBidButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
placeBid();
}
});

closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
closeClient();
}
});

// Connect to the server


connectToServer();
}

// Method to connect to the server


private void connectToServer() {
try {
socket = new Socket("localhost", 8080);
out = new PrintWriter(socket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
startAuction();
} catch (IOException e) {
JOptionPane.showMessageDialog(this, "Unable to connect to the server.", "Error",
JOptionPane.ERROR_MESSAGE);
}
}

// Method to place a bid


private void placeBid() {

13
String bidderName = bidderNameField.getText();
String bidPrice = bidPriceField.getText();

if (!bidderName.isEmpty() && !bidPrice.isEmpty()) {


out.println(bidderName + ";" + bidPrice); // Send bid to server
bidderNameField.setText("");
bidPriceField.setText("");
} else {
JOptionPane.showMessageDialog(this, "Please fill in both bidder name and bid price.", "Error",
JOptionPane.ERROR_MESSAGE);
}
}

// Method to start the auction timer and update UI with item details
private void startAuction() {
auctionTimer = new Timer(1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
timeLeft--;
updateTimer();
if (timeLeft == 0) {
auctionTimer.stop();
JOptionPane.showMessageDialog(null, "Auction Ended!", "Info",
JOptionPane.INFORMATION_MESSAGE);
}
}
});
auctionTimer.start();

// Simulate receiving auction item details from the server


itemNameLabel.setText("ITEM NAME: Sample Item");
priceLabel.setText("PRICE: Rs1000");
imageLabel.setText("ITEM IMAGE: Sample.jpg");
timerLabel.setText("TIMER: 01:00");
}

// Method to update the timer label


private void updateTimer() {
int minutes = timeLeft / 60;
int seconds = timeLeft % 60;

14
timerLabel.setText(String.format("TIMER: %02d:%02d", minutes, seconds));
}

// Method to close the client connection


private void closeClient() {
try {
if (socket != null) {
socket.close();
}
System.exit(0);
} catch (IOException e) {
e.printStackTrace();
}
}

public static void main(String[] args) {


SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new Client().setVisible(true);
}
});
}
}

6.0 Actual Resources Used

Sr. No. Equipment Name with Broad Specification Quantity

1. Desktop pc – Windows 10 1

2. Editor – Visual Studio Code 1

3. Software – JDK 1.8 1

15
7.0 Outputs of the Micro-Projects

16
8.0 Skill Developed / learning out of this Micro-Project
The following skills were developed while performing and developing this micro project:
● Designing: Designing of micro projects with minimum required resources and at low cost.
● Teamwork: Learned to work in a team and boost individual confidence.
● Time Management: Timely completion of micro project as scheduled.
● Data Analysis: Analyzing the data collected during the processes.
● Interpretation of Data: Drawing and analysis of graphs, laboratory calculations etc.
● Problem-solving: Develop good problem-solving habits.
● Technical writing: Preparing a report of the proposed plan and final report.

9.0 Application of this Micro-Project

In this micro-project, the Graphical User Interface (GUI) is developed using Java's Swing framework,
allowing for an interactive platform where users can input data and trigger various events through
components like buttons, text fields, and checkboxes. Swing provides a lightweight, platform-
independent interface that enhances user interaction. The GUI serves as a bridge between the user and
the underlying functionalities of the application, making it intuitive and easy to navigate. Additionally,
the project involves implementing server and server socket programming to establish a network-based
communication system. A ServerSocket is created to listen for client connections, enabling the server
to handle requests, send responses, and maintain a steady connection with the client. This enables the
program to handle multiple client requests and create a reliable communication channel for data
transfer, demonstrating the core concepts of Java networking and server-client interaction.

17
Annexure – III

Suggested Rubric for Assessment of Micro-Project


S. Characteristic to Poor Average Good Excellent (
No. be assessed ( Marks 1 - 3 ) ( Marks 4 - 5 ) ( Marks 6 - 8 ) Marks 9- 10 )
Relevance to the Relate to very Related to some Take care of at-least Take care of more
1
course few LOs LOs one CO than one CO
Not more than At-least 5
Literature review About 10 relevant
two sources relevant At –least 7 relevant
2 /information sources, at least sources, most
very old sources, most latest
collection latest
reference 2 latest
Completion of the
Completed less Completed 50 to Completed more
3 Target as per Completed 60 to 80%
than 50% 60% than 80 %
project proposal
Sufficient and
appropriate Sufficient and
Data neither Enough data
enough data appropriate enough
Analysis of Data organized nor collected and
generated but data generated which
4 and representation presented well sufficient and
not organized is organized and but
presenting data.
and not not used.
presented well.
Well assembled
Just assembled Well assembled and
with proper
Quality of Incomplete and some code functioning parts.
functioning parts..
5 Prototype/Model Programming is not But no creativity in
Creativity in
code functioning design and use of
design and use of
well. graphics function
graphics function
Nearly sufficient
Very short, and Detailed, correct and
Details about correct details Very detailed,
clear description of
methods, and correct, clear
about methods, methods and
6 Report Preparation conclusions description of
and conclusion. Conclusions.
omitted, some methods, and
but clarity is Sufficient Graphic
details are conclusions.
not there in the Description.
wrong
presentation.
Major Includes major
information is information but Includes major Well organized,
Presentation of the not included, not well information and well includes major
7 information is organized and
micro project organized but not information ,well
not well not presented presented well presented
organized. well
Replied to
Could not reply
considerable
to a Replied properly to a
number of Replied most of the
8 Viva considerable considerable number
questions but questions properly
number of of questions.
not very
questions.
properly

18
Annexure – IV

Micro Project Evaluation Sheet


Name of Student: Pranjal Nirmal, Riya Negi Semester: Fifth

Enrollment No: 23150920727, 28 Course Title: Advance Java Programming

Name of Program: CO5I-B Course Code: 22517

Title of the Micro-Project: Online Auction


Website Cos addressed by Micro Project:

A: Develop programs using GUI framework (AWT and Swing) [✔]


B: Handle events of AWT and Swing Components [✔]
C: Develop programs to handle events in Java Programming [✔]
D: Develop Java programs using Networking Concepts [ ]
E: Develop programs using Database [ ]
F: Develop programs using Servlets [ ]

Sr. Poor
No Characteristic to be Average (Marks Good Excellent (
( Marks 1- Sub Total
. assessed 3)
4-5 ) (Marks 6-8) Mark 9-10)

(A) Process and Product Assessment (Convert Above Total marks out of 6 Marks)

1 Relevance to the course


2 Information Collection
3 Project Proposal
Completion of the Target as
4 per project proposal
Analysis of Data and
5
representation

6 Quality of Prototype/Model

7 Report Preparation
(B) Individual Presentation / Viva (Convert above total marks out of 4 marks)

8 Presentation

9 Defense

19
Process and Product Individual Presentation / Total Marks
Roll No.
Assessment (6 Marks) Viva (4 Marks) 10
70

71

Comments/Suggestions about teamwork/leadership/interpersonal communication (if any)


………………………………………………………………………………………………
……………………………………………………………………………………………..
……………………………………………………………………………………………..
……………………………………………………………………………………………..

Name and designation of the Teacher: Mrs. Pratibha Pednekar (Lecturer) Dated
Signature:

20

You might also like