You are on page 1of 23

Koneru Lakshmaiah Education Foundation

(Deemed to be University)
FRESHMAN ENGINEERING DEPARTMENT
A Project Based Lab Report

On

PRODUCT SURVEY
SUBMITTED BY:

ID.no: Name:

2300032491 M. Prudhvi Narayan

2300032507 S. Bhavya Varshitha

2300032650 G. Jyothirmayee

2300032674 M. Vasanth Kumar Reddy

UNDER THE GUIDANCE OF

Mrs. G. Rajini Reddy

Assistant Professor,CSE.

KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.
DEPARTMENT OF BASIC ENGINEERING SCIENCES-1

CERTIFICATE

This is to certify that the project based laboratory report entitled


“Product Survey” submitted by Mr./Ms. M.Prudhvi Narayan, S. Bhavya Varshitha,
G.Jyothirmayee, M.Vasanth Kumar Reddy bearing Regd. No. 2300032491,
2300032507, 2300032650 , 2300032674 to the Department of Basic
Engineering Sciences-1, KL University in partial fulfillment of the requirements
for the completion of a project based Laboratory in “Computational Thinking for
Object Oriented Programming - 23SC1203”course in I B Tech II Semester, is a
bonafide record of the work carried out by them under my supervision during the
academic year 2023 – 2024.

PROJECT SUPERVISOR HEAD OF THE DEPARTMENT

Mrs. G.Rajani Reddy Dr. D.Haritha


ACKNOWLEDGEMENTS

It is great pleasure for us to express our gratitude to our honorable President Sri.
Koneru Satyanarayana, for giving the opportunity and platform with facilities in
accomplishing the project-based laboratory report.

We express the sincere gratitude to our director Dr. A Jagadeesh for his
administration towards our academic growth.

We express sincere gratitude to our Coordinator Dr. M. Siva Ganga Prasad and
HOD-BES1Dr. D.Haritha for her leadership and constant motivation provided in
successful completion of our academic semester. We record it as our privilege to deeply
thank for providing us the efficient faculty and facilities to make our ideas into reality.

We express our sincere thanks to our project supervisor Mrs.G.Rajini Reddy for
her novel association of ideas, encouragement, appreciation, and intellectual zeal which
motivated us to venture this project successfully.

Finally, it is pleased to acknowledge the indebtedness to all those who devoted


themselves directly or indirectly to make this project report success.

2300032491 M.Prudhvi Narayan

2300032507 S.Bhavya Varshitha

2300032650 G.Jyothirmayee

2300032674 M.Vasanth Kumar Reddy


ABSTRACT

Product Survey is a Java-based GUI program designed to facilitate the conduction


and analysis of surveys on three categories: Air Conditioners (AC), Mobile Phones, and
Laptops. The primary objective of Product Survey is to gather user opinions on various
models within each category, allowing users to rate products as either good or bad. The
program then aggregates these ratings across multiple users to generate rankings for
each product.

Survey Conductor offers a user-friendly interface, making it accessible to a wide


range of users. Upon launching the program, users are presented with three options to
select their desired survey category. Once a category is chosen, Product Survey displays
five different models within that category, prompting the user to provide their opinion
on each model.

For each model, users can select whether they consider it to be good or bad based
on their personal experiences or preferences. The program records these ratings and
stores them for analysis. To ensure robustness and reliability of the rankings, Product
Survey requires input from at least five users for each model.

After collecting opinions from five users for all models within a category, Product
Survey compiles the data and calculates the overall ratings for each model. It then
generates a ranked list, showcasing the most preferred products at the top and the least
preferred ones at the bottom. These rankings provide valuable insights into consumer
preferences within each category.

Product Survey employs Java's Graphical User Interface (GUI) capabilities to


enhance user interaction and experience. The intuitive design of the interface ensures
that users can navigate the survey process effortlessly, contributing to the efficiency of
data collection.
INDEX
S.NO TITLE PAGE NO

1 Introduction 1

2 Aim of the Project 2

2.1 Advantages & Disadvantages 2

2.2 Future Implementation 2

3 Software & Hardware Details 3

4 Class Diagram 4

5 Algorithm 5

6 Implementation 6

7 Integration and System Testing 14

8 Conclusion 17
INTRODUCTION

Concepts:

GUI:
In Java applications, the components that comprise a GUI (Graphical User Interface)
are stored in containers called forms. The Java language provides a set of user interface
components from which GUI forms can be built.

User Input and Output:

The input is the data that we give to the program. The output is the data what we
receive from the program in the form of result.

ActionListener Interface:

Implementing this interface to handle user interactions with GUI components (e.g.,
button clicks triggering survey responses).

 This Survey application is a GUI-based product survey application developed


using the Java programming language.
 It is designed to conduct product survey applications in general.
 The survey application consists of three levels, namely, Air Conditioners , Mobile
Phones, and Laptops .
 A user is given a product within the selected category and asked to rate their
experience as good or bad.
 The process should then be repeated for at least five users.
 The application should then display a Rank of the user experience after collecting
the experiences from the five or more users.
 This survey application is a simple working tool to capture the general idea about
the consumers’ needs and their attitude to particular product categories and
models.

1
AIM

Advantages:-

1. A user-friendly interface as it has a graphic and intuitive way for the user to take
part in the survey, automated data collection it makes the surveyor’s work easier
and easy to analyze.
2. Real-time feedback enables the user view response in terms of the ranking
according to collected data.
3. Scalable extensive to include more products on the category without any changes
in logic.
4. It has educational values, a practical instance for learning how to design a GUI and
handling data in Java.

Disadvantages:-

1. The survey can potentially capture only binary feedback: Good/Bad, which may
not reflect the users’ true opinions .
2. The results can be highly biased based on the small number of users and their
preferences.
3. Ranking the products purely by user ratings can lead to oversimplified product
performance evaluation.
4. One must additionally acquire knowledge of Java GUI frameworks, which can
complicate the application’s further development and support.

Future Enhancements:-

1. Implementing a user login system to identify individual participants. This


enhancement can track users' responses over multiple sessions, providing more
insights into user preferences and behavior.
2. Enhance the GUI to display graphical representations like bar charts or pie charts
of survey results. This visualization can provide a clearer overview of product
rankings and user feedback.

2
SYSTEM REQUIREMENTS
 SOFTWARE REQUIREMENTS:
The major software requirements of the project are as follows:
Language : JAVA
Operating System: Windows Xp or later.

 HARDWARE REQUIREMENTS:

The hardware requirements that map towards the software are as follows:

RAM : Minimum 2GB, Recommended 4GB or higher

Processor : Any modern processor (e.g., Intel Core i3 or equivalent)

3
CLASS DIAGRAM

4
ALGORITHM
1.Initialization:

i. Create a JFrame window for the survey program.


ii. Set the size, title, and close operation of the window.
iii. Set the background color of the window to yellow.
iv. Initialize GUI components like labels, combo boxes, and buttons.
v. Set layout to GridBagLayout and define GridBagConstraints for layout
management.

2.Adding Components:

i. Add a title label with a large font size to emphasize the purpose of the survey.
ii. Add a category label and a combo box for selecting the product category (e.g.,
AC, Mobile Phone, Laptop).
iii. Add a model label and a combo box that dynamically changes based on the
selected category.
iv. Add a submit button to submit the survey.

3.Populating Models:

I. Initialize a HashMap (modelsMap) to store models for each category.


II. Populate models Map with predefined models for AC, Mobile Phone, and
Laptop categories.
III. Implement an action listener for the category combo box to dynamically
update the model combo box based on the selected category.

4.Survey Submission:

i. Implement the action Performed method to handle the submit button click
event.
ii. Retrieve the selected model from the model combo box.
iii. Prompt the user to input their rating for the selected model (Good/Bad).
iv. Validate the input rating and update the ratings map accordingly.

5
IMPLEMENTATION

import javax.swing.*;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.util.HashMap;

public class SurveyProgram extends JFrame {

public SurveyProgram() {

setTitle("Welcome");

setSize(400, 300);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPanel panel = new JPanel(new BorderLayout());

ImageIcon icon = new ImageIcon("C:\\Users\\VASANTH KUMAR


REDDY\\Desktop\\AdobeStock_420095419_Preview.jpeg");

JLabel imageLabel = new JLabel(icon);

panel.add(imageLabel, BorderLayout.CENTER);

JButton accessButton = new JButton("Access Survey");

accessButton.setPreferredSize(new Dimension(200, 50));

6
accessButton.setBackground(Color.WHITE);

accessButton.addActionListener(e -> {

SurveyFrame surveyFrame = new SurveyFrame();

surveyFrame.setVisible(true);

dispose();

});

panel.add(accessButton, BorderLayout.SOUTH);

add(panel);

public static void main(String[] args) {

SwingUtilities.invokeLater(() -> {

SurveyProgram mainFrame = new SurveyProgram();

mainFrame.setVisible(true);

});

class SurveyFrame extends JFrame implements ActionListener {

private JLabel titleLabel, categoryLabel, modelLabel;

private JComboBox<String> categoryComboBox, modelComboBox;

private JButton submitButton;

7
private HashMap<String, String[]> modelsMap;

private HashMap<String, Integer> ratingsMap;

public SurveyFrame() {

setTitle("Product Survey");

setSize(600, 400);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

getContentPane().setBackground(Color.YELLOW);

initializeSurvey();

private void initializeSurvey() {

setLayout(new GridBagLayout());

GridBagConstraints gbc = new GridBagConstraints();

gbc.fill = GridBagConstraints.HORIZONTAL;

gbc.insets = new Insets(10, 10, 10, 10);

titleLabel = new JLabel("Please take the survey:");

titleLabel.setFont(new Font("Arial", Font.BOLD, 24));

gbc.gridx = 0;

gbc.gridy = 0;

8
gbc.gridwidth = 2;

gbc.anchor = GridBagConstraints.CENTER;

add(titleLabel, gbc);

gbc.gridx = 0;

gbc.gridy = 1;

gbc.gridwidth = 1;

gbc.anchor = GridBagConstraints.LINE_END;

add(new JLabel("Select category:"), gbc);

gbc.gridx = 1;

gbc.anchor = GridBagConstraints.LINE_START;

categoryComboBox = new JComboBox<>(new String[]{"AC", "Mobile


Phone", "Laptop"});

categoryComboBox.setFont(new Font("Arial", Font.PLAIN, 18));

add(categoryComboBox, gbc);

gbc.gridx = 0;

gbc.gridy = 2;

gbc.anchor = GridBagConstraints.LINE_END;

add(new JLabel("Select model:"), gbc);

gbc.gridx = 1;

9
gbc.anchor = GridBagConstraints.LINE_START;

modelComboBox = new JComboBox<>();

modelComboBox.setFont(new Font("Arial", Font.PLAIN, 18));

add(modelComboBox, gbc);

gbc.gridx = 0;

gbc.gridy = 3;

gbc.gridwidth = 2;

gbc.anchor = GridBagConstraints.CENTER;

submitButton = new JButton("Submit");

submitButton.setBackground(Color.RED);

submitButton.setFont(new Font("Arial", Font.BOLD, 18));

submitButton.addActionListener(this);

add(submitButton, gbc);

modelsMap = new HashMap<>();

modelsMap.put("AC", new String[]{"Model 1", "Model 2", "Model 3",


"Model 4", "Model 5"});

modelsMap.put("Mobile Phone", new String[]{"Model A", "Model B",


"Model C", "Model D", "Model E"});

modelsMap.put("Laptop", new String[]{"Model X", "Model Y", "Model Z",


"Model W", "Model V"});

ratingsMap = new HashMap<>();

10
categoryComboBox.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

String category = (String) categoryComboBox.getSelectedItem();

String[] models = modelsMap.get(category);

modelComboBox.removeAllItems();

for (String model : models) {

modelComboBox.addItem(model);

});

@Override

public void actionPerformed(ActionEvent e) {

String selectedModel = (String) modelComboBox.getSelectedItem();

String rating = JOptionPane.showInputDialog(this, "How do you rate "


+ selectedModel + "? (Good/Bad)");

if (rating != null && (rating.equalsIgnoreCase("good") ||


rating.equalsIgnoreCase("bad"))) {

int currentRating = ratingsMap.getOrDefault(selectedModel, 0);

if (rating.equalsIgnoreCase("good")) {

11
currentRating++;

} else {

currentRating--;

ratingsMap.put(selectedModel, currentRating);

JOptionPane.showMessageDialog(this, "Thank you for your rating!");

displayThankYouFrame();

} else {

JOptionPane.showMessageDialog(this, "Invalid rating. Please enter


either 'Good' or 'Bad'.");

private void displayThankYouFrame() {

ThankYouFrame thankYouFrame = new ThankYouFrame();

thankYouFrame.setVisible(true);

dispose(); // Close the current frame

class ThankYouFrame extends JFrame {

public ThankYouFrame() {

setTitle("Thank You");

12
setSize(400, 300);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPanel panel = new JPanel(new BorderLayout());

ImageIcon icon = new ImageIcon("C:\\Users\\VASANTH KUMAR


REDDY\\Downloads\\AdobeStock_143012861_Preview.jpeg");

JLabel imageLabel = new JLabel(icon);

panel.add(imageLabel, BorderLayout.CENTER);

JButton thankYouButton = new JButton("End Survey");

thankYouButton.setPreferredSize(new Dimension(200, 50));

thankYouButton.setBackground(Color.WHITE);

thankYouButton.addActionListener(e -> System.exit(0));

panel.add(thankYouButton, BorderLayout.SOUTH);

add(panel);

13
INTEGRATION AND SYSTEM TESTING

OUTPUT:

Screen Shots:

14
15
16
CONCLUSION

The GUI-based survey program that has been developed is a


comprehensive tool that facilitates the seamless conduction of surveys on
three distinct categories of products: air conditioners, mobile phones, and
laptops. Within each category, the software provides options for users to
rate the quality of five different models based on their individual preferences
and opinions.

The program then collects the ratings of five users for each model in the
survey and compiles a final ranking for each model within every product
category. This allows users to make an informed decision about selecting the
best product among all the models. The final rankings of each model are
presented to the user in a clear and concise manner, enabling them to easily
decipher which options are the most suitable for their specific needs.
Overall, this program is a valuable resource for conducting product surveys
and making well-informed purchasing decisions.

17

You might also like