0% found this document useful (0 votes)
17 views93 pages

SCM Final

The document outlines a project for a Movie Ticket Booking System as part of a Software Construction and Maintenance course. It includes a detailed login module with Java code, showcasing the user interface and functionality for user login, sign-up, and ticket booking. Additionally, it discusses improvements made to variable and function names for better readability and maintainability of the code.

Uploaded by

naresh.r2021
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)
17 views93 pages

SCM Final

The document outlines a project for a Movie Ticket Booking System as part of a Software Construction and Maintenance course. It includes a detailed login module with Java code, showcasing the user interface and functionality for user login, sign-up, and ticket booking. Additionally, it discusses improvements made to variable and function names for better readability and maintainability of the code.

Uploaded by

naresh.r2021
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/ 93

SCHOOL OF COMPUTER SCIENCE ENGINEERING AND

INFORMATION SYSTEMS
FALL SEMESTER 2023-2024

Course : Software Construction and Maintenance


Movie Ticket Booking System
Course Code: SWE2007
Faculty: Dr.S.Sree Dharinya

FINAL DOCUMENT

DONE BY:
PAVAN V – 21MIS0044
KAUSHIK K - 21MIS0332
NARESH R – 21MIS0335
KISHORE S – 21MIS0280
SOMASEKHAR N – 21MIS0220
LOGIN MODULE:
Interface:

Existing Code:
import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.JOptionPane;

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/
/**

* @author KISHORE S

*/

public class LOGIN extends javax.swing.JFrame {

/**

* Creates new form LOGIN

*/

public LOGIN() {

initComponents();

this.icon2.setVisible(false);

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel4 = new javax.swing.JLabel();

jLabel5 = new javax.swing.JLabel();

jPanel2 = new javax.swing.JPanel();

jButton1 = new javax.swing.JButton();

jButton3 = new javax.swing.JButton();

jLabel6 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();


jLabel3 = new javax.swing.JLabel();

jTextField1 = new javax.swing.JTextField();

jPasswordField1 = new javax.swing.JPasswordField();

icon1 = new javax.swing.JLabel();

icon2 = new javax.swing.JLabel();

jButton2 = new javax.swing.JButton();

jLabel7 = new javax.swing.JLabel();

jLabel4.setText("jLabel4");

jLabel5.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/movie/ticket/booking/bookYOURshow
blac.jpg"))); // NOI18N

jLabel5.setText("jLabel5");

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setLocation(new java.awt.Point(0, 0));

jPanel2.setLayout(null);

jButton1.setBackground(new java.awt.Color(255, 255, 255));

jButton1.setFont(new java.awt.Font("Arial", 1, 13)); // NOI18N

jButton1.setText("LOGIN");

jButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton1ActionPerformed(evt);

});

jPanel2.add(jButton1);

jButton1.setBounds(210, 330, 90, 40);

jButton3.setBackground(new java.awt.Color(255, 0, 0));

jButton3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

jButton3.setForeground(new java.awt.Color(255, 255, 255));


jButton3.setText("NEW USER?SIGN UP");

jButton3.setBorder(new
javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

jButton3.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton3ActionPerformed(evt);

});

jPanel2.add(jButton3);

jButton3.setBounds(180, 400, 160, 30);

jLabel6.setIcon(new javax.swing.ImageIcon("C:\\Users\\kaush\\Downloads\\logo white.jpg")); //


NOI18N

jLabel6.setText("jLabel6");

jPanel2.add(jLabel6);

jLabel6.setBounds(210, 70, 100, 90);

jLabel2.setBackground(new java.awt.Color(153, 153, 255));

jLabel2.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N

jLabel2.setForeground(new java.awt.Color(255, 255, 255));

jLabel2.setText("USERNAME");

jPanel2.add(jLabel2);

jLabel2.setBounds(140, 190, 140, 60);

jLabel3.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N

jLabel3.setForeground(new java.awt.Color(255, 255, 255));

jLabel3.setText("PASSWORD");

jPanel2.add(jLabel3);

jLabel3.setBounds(140, 270, 120, 20);

jTextField1.setFont(new java.awt.Font("Arial", 0, 13)); // NOI18N

jTextField1.setForeground(new java.awt.Color(5, 5, 5));


jPanel2.add(jTextField1);

jTextField1.setBounds(270, 200, 130, 30);

jPasswordField1.setFont(new java.awt.Font("Arial", 0, 13)); // NOI18N

jPanel2.add(jPasswordField1);

jPasswordField1.setBounds(270, 260, 130, 30);

icon1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/movie/ticket/booking/eye
icon.jpg"))); // NOI18N

icon1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mousePressed(java.awt.event.MouseEvent evt) {

icon1MousePressed(evt);

});

jPanel2.add(icon1);

icon1.setBounds(400, 260, 30, 30);

icon2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/movie/WhatsApp Image


2022-11-13 at 9.26.14 PM.jpeg"))); // NOI18N

icon2.setMaximumSize(new java.awt.Dimension(30, 43));

icon2.setMinimumSize(new java.awt.Dimension(30, 43));

icon2.addMouseListener(new java.awt.event.MouseAdapter() {

public void mousePressed(java.awt.event.MouseEvent evt) {

icon2MousePressed(evt);

});

jPanel2.add(icon2);

icon2.setBounds(400, 260, 30, 30);

jButton2.setBackground(new java.awt.Color(255, 0, 0));

jButton2.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N

jButton2.setForeground(new java.awt.Color(255, 255, 255));


jButton2.setText("ALREADY BOOKED?");

jButton2.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton2ActionPerformed(evt);

});

jPanel2.add(jButton2);

jButton2.setBounds(180, 440, 160, 30);

jLabel7.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/movie/ticket/booking/bookYOURshow blac.jpg")));
// NOI18N

jLabel7.setText("jLabel7");

jPanel2.add(jLabel7);

jLabel7.setBounds(0, 0, 1080, 510);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 1079, javax.swing.GroupLayout.PREFERRED_SIZE)

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 505, javax.swing.GroupLayout.PREFERRED_SIZE)

);

pack();

setLocationRelativeTo(null);

}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

choose_movie cm=new choose_movie();

cm.jLabel4.setText(jTextField1.getText());

try

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

String sql="Select * from moviefake where username=? and password=?";

PreparedStatement pst=con.prepareStatement(sql);

pst.setString(1,jTextField1.getText());

pst.setString(2,jPasswordField1.getText());

ResultSet rs=pst.executeQuery();

if(rs.next())

{// TODO add your handling code here:

JOptionPane.showMessageDialog(null,"Login Successful");

setVisible(false);

cm.setVisible(true);

else

JOptionPane.showMessageDialog(null,"Invalid login credentials");

con.close();

catch(Exception e)

JOptionPane.showMessageDialog(null,e);

}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

setVisible(false);

Newuser n=new Newuser();

n.setVisible(true); // TODO add your handling code here:

private void icon1MousePressed(java.awt.event.MouseEvent evt) {

icon2.setVisible(true);

icon1.setVisible(false);

jPasswordField1.setEchoChar((char)0);

private void icon2MousePressed(java.awt.event.MouseEvent evt) {

icon1.setVisible(true);

icon2.setVisible(false);

jPasswordField1.setEchoChar('*');

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

try

String username=jTextField1.getText();

String sql="SELECT * FROM moviefake WHERE username='"+username+"'";

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement(sql);

ResultSet rs=pst.executeQuery();

if(rs.next())

String mve=rs.getString(6);

String st=rs.getString(10);

String amt=rs.getString(14);
String dt=rs.getString(7);

String tms=rs.getString(8);

String ttre=rs.getString(9);

setVisible(false);

ticket t=new ticket();

t.mve.setText(movie);

t.Dt.setText(date);

t.Ttre.setText(theatre);

t.Tkts.setText(seat);

t.Total.setText(amount);

t.Tms.setText(time);

t.setVisible(true);

}catch (SQLException ex) {

Logger.getLogger(LOGIN.class.getName()).log(Level.SEVERE, null, ex);

} // TODO add your handling code here:

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(LOGIN.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(LOGIN.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(LOGIN.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(LOGIN.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new LOGIN().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JLabel icon1;

private javax.swing.JLabel icon2;

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton2;

private javax.swing.JButton jButton3;

private javax.swing.JLabel jLabel2;


private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel jLabel7;

private javax.swing.JPanel jPanel2;

private javax.swing.JPasswordField jPasswordField1;

private javax.swing.JTextField jTextField1;

// End of variables declaration

MINIMIZED CODE:
1) NAME:
a. Variable Name
Renaming variables is the process of changing the names of variables in a program's
source code to make the code more readable, maintainable, or to adhere to specific
naming conventions.
Existing Code:
String mve=rs.getString(6);
String st=rs.getString(10);
String amt=rs.getString(14);
String dt=rs.getString(7);
String tms=rs.getString(8);
String ttre=rs.getString(9);
Changed Code:
String movie = resultSet.getString(6);
String seat = resultSet.getString(10);
String amount = resultSet.getString(14);
String date = resultSet.getString(7);
String time = resultSet.getString(8);
String theatre = resultSet.getString(9);

Existing Code:
private javax.swing.JLabel icon1;
private javax.swing.JLabel icon2; private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel2;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JTextField jTextField1;

Changed Code:
private javax.swing.JButton jButtonLogin;
private javax.swing.JButton jButtonSignUp;
private javax.swing.JButton jButtonAlreadyBooked;
private javax.swing.JLabel jLabelUsername;
private javax.swing.JLabel jLabelPassword;
private javax.swing.JPanel jPanelLogin;
private javax.swing.JTextField jTextFieldUsername;
private javax.swing.JPasswordField jPasswordFieldPassword;
private javax.swing.JLabel jLabelPasswordIcon;

1.1) Function Name


Renaming function names is the process of changing the names of functions or methods in a
program's source code. Just like renaming variables, renaming function names is done to
improve code readability, maintainability, and consistency.

Existing Code:
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)
Changed Code:
private void SignUpActionPerformed(java.awt.event.ActionEvent evt)

Existing Code:
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
Changed Code:
private void jButtonAlreadyBookedActionPerformed(java.awt.event.ActionEvent evt)
2) Comment
Certainly,we make the comments in your code simpler and more readable.we
removed unwanted comment modify some of the comment.
existing comment:

* Set the Nimbus look and feel */

changed comment:

// Set the look and feel for the application

example for some comment added are:


public LoginFrame() {
initComponents(); // Initialize the UI components
hidePasswordIcon(); // Hide the password icon (assuming this is a function for
UI behavior)
}

private void initComponents() {


initUIComponents(); // Initialize the user interface components
}
private void SignUpActionPerformed(java.awt.event.ActionEvent evt) {
// Hide the login frame and show the NewUserFrame for signing up
setVisible(false);
NewUserFrame newUser = new NewUserFrame();
newUser.setVisible(true);
}

3)Idioms

Idioms refers to a specific way of writing code or a coding practice that is considered
best or standard for accomplishing a particular task. These coding idioms are often
well-established and widely accepted by the programming community as effective
and efficient ways to solve common problems.

In Example, we used in private void SignUpActionPerformed(java.awt.event.ActionEvent


evt) method.
if(rs.next())
{
JOptionPane.showMessageDialog(null,"Login Successful");
setVisible(false);
cm.setVisible(true);
}
else
{
JOptionPane.showMessageDialog(null,"Invalid login credentials");
}
con.close();
}

Average case , best case and worst case :


1. Best Case Scenario:
- In the best-case scenario, the code is executed with an optimal condition where the
username and password provided match a record in the database, and there are no
issues with database connectivity.
- The best-case time complexity mainly depends on the database's performance and
indexing. If the database is well-optimized, it may execute the query in constant time
or O(1).
- The best-case time complexity is O(1).

2. Average Case Scenario:


- In the average-case scenario, the code handles a typical situation where the
database may contain a large number of records, and the provided username and
password match an entry.
- The time complexity for database queries depends on various factors such as the
number of records, indexing, and server load. It's typically O(n), where 'n' is the
number of records in the database table.
- Additionally, the code may encounter network latency, which can also contribute
to the average-case time complexity.
- The average-case time complexity is O(n).

3. Worst Case Scenario:


- The worst-case scenario involves multiple potential issues:
- The database server is unreachable or down.
- The username and password provided do not match any records in the database.
- In this scenario, the code will experience the maximum possible delay due to
database errors, and it will take longer to complete.
- The time complexity can be dominated by database connection failures, query
execution time, and handling exceptions.
- If the database is unresponsive or unavailable, the code may experience a
significant delay.
- In such cases, it's hard to specify an exact time complexity, but it could be
considered O(n) for the query execution, where 'n' is the number of records.

Overall, the performance of this code heavily depends on the database setup, network
conditions, and the number of records in the database table. In the best case, it can be
very efficient, but in the worst case, it may experience significant delays due to
database issues. Proper error handling and database optimization are important
considerations to improve its performance.
Pseudocode:

class LOGIN {
constructor LOGIN():
// Initialize the components
initComponents()
Hide the 'icon2' label

method initComponents():
// Initialize and configure the UI components
Create JFrame and JPanel
Create JLabels, JButtons, JTextField, JPasswordField, and set their properties
Add ActionListeners and MouseListeners to buttons and icons
Set layout for the JPanel
Add components to the JPanel

method jButton1ActionPerformed(evt):
// Event handler for the LOGIN button
Create an instance of choose_movie
Set the 'jLabel4' of choose_movie with the text from 'jTextField1'
Try:
Load the MySQL JDBC driver
Establish a database connection
Create a PreparedStatement with a SQL query to check credentials
Set parameters in the PreparedStatement with values from 'jTextField1' and
'jPasswordField1'
Execute the query and get the ResultSet
If ResultSet has data:
Show a success message
Hide the current LOGIN frame
Show the choose_movie frame
Else:
Show an error message
Close the database connection
Catch any exceptions and show an error message

method jButton3ActionPerformed(evt):
// Event handler for the "NEW USER?SIGN UP" button
Hide the current LOGIN frame
Create an instance of Newuser and show it

method icon1MousePressed(evt):
// Event handler for when the eye icon is clicked (password visibility)
Show 'icon2' and hide 'icon1'
Set the echo character of 'jPasswordField1' to 0 (revealing password)
method icon2MousePressed(evt):
// Event handler for when the crossed eye icon is clicked (password visibility)
Show 'icon1' and hide 'icon2'
Set the echo character of 'jPasswordField1' to '*' (hiding password)

method jButton2ActionPerformed(evt):
// Event handler for the "ALREADY BOOKED?" button
Try:
Get the username from 'jTextField1'
Create a SQL query to retrieve user booking information
Establish a database connection
Create a PreparedStatement and execute the query
If there is a result:
Get booking information
Hide the current LOGIN frame
Create an instance of ticket and set its labels with the booking information
Show the ticket frame
Catch any SQLException and log the error

method main(args):
Create an instance
Defensive Programming Techniques:
1. Exception Handling:
- Exception handling is used throughout the code using `try-catch` blocks. It helps to catch
and handle exceptions that may occur during database operations, preventing the application
from crashing.
apply 10 technique exception handling
1. Logging the Exception:
try {
String username = user.getText();
String amt = amount.getText();
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/movie", "root", "");
PreparedStatement pst = con.prepareStatement("update moviefake set amount='Rs."
+ amt + "',payment_method='GPAY' where username='" + username + "'");
pst.executeUpdate();
} catch (SQLException ex) {
// Logging the exception
Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE, null, ex);
}

2. Rethrowing the Exception:


try {
// Code block...
} catch (SQLException ex) {
// Rethrowing the exception as a new runtime exception
throw new RuntimeException("Error updating movie details", ex);
}

3. Custom Error Handling or User Notification:


try {
// Code block...
} catch (SQLException ex) {
// Custom error handling or user notification
// e.g., Display an error message to the user
System.err.println("Error: " + ex.getMessage());
}
4. Graceful Error Handling or Recovery Mechanism:
try {
// Code block...
} catch (SQLException ex) {
// Graceful error handling or recovery mechanism
// e.g., Rollback changes in case of a database error
con.rollback();
}
5. Use of Finally Block:
try {
// Code block...
} catch (SQLException ex) {
// Exception handling
} finally {
// Cleanup or resource release code in a finally block
// e.g., Close the connection or release resources
}
6. Exception Suppression:
try {
// Code block...
} catch (SQLException ex) {
// Handling SQLException
} catch (Exception ex) {
// Handling other exceptions and possibly suppressing the original exception
ex.printStackTrace(); // Suppressing the exception
}
7. Specific Exception Handling with Different Actions:
try {
// Code block...
} catch (SQLException ex) {
// Handling SQLException with specific actions
} catch (SomeOtherException ex) {
// Handling SomeOtherException differently
}
8. Nested Try-Catch Blocks:
try {
// Code block...
} catch (SQLException ex) {
try {
// Nested try-catch for more specific handling or recovery
// ...
} catch (Exception nestedEx) {
// Handling exceptions within the nested block
}
}
9. Error Reporting and User Feedback:
try {
// Code block...
} catch (SQLException ex) {
// Error reporting to the user
System.err.println("Error: " + ex.getMessage());
}
10. Contingency Planning with Default Behavior:
try {
// Code block...
} catch (SQLException ex) {
// If an exception occurs, perform a default action or revert changes
// e.g., Log the error and revert to a previous state
}

2. Protecting your program from Invalid Inputs :


Username Validation:

Ensure that the username is not empty.


You might want to impose constraints on the length of the username (e.g., minimum
and maximum length).
You can restrict the types of characters allowed in the username (e.g., alphanumeric
characters only).
Password Validation:

Ensure that the password is not empty.


Enforce a minimum password length to improve security.
You can require specific rules for the password, such as including both letters and
numbers, special characters, etc.
example: In the 'jButtonLoginActionPerformed' method, we need to check valid
username and password before pressing login button
3. Error Handling:
if (resultSet.next()) {
JOptionPane.showMessageDialog(null, "Login Successful");
setVisible(false);
chooseMovie.setVisible(true);
} else {
JOptionPane.showMessageDialog(null, "Invalid login credentials");
}
4.Assertions:
- No assertions are used in my module.
CHOOSE THEATRE MODULE:
Interface:

Existing Code:
import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.SQLException;

import java.util.logging.Level;

import java.util.logging.Logger;

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

* @author NARESH
*/

public class choose_theatre extends javax.swing.JFrame {

/**

* Creates new form choose_theatre

*/

public choose_theatre() {

initComponents();

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

private void initComponents() {

jPanel1 = new javax.swing.JPanel();

pvr = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jButton2 = new javax.swing.JButton();

jButton3 = new javax.swing.JButton();

jButton4 = new javax.swing.JButton();

jButton5 = new javax.swing.JButton();

inox = new javax.swing.JLabel();

jLabel4 = new javax.swing.JLabel();

jButton6 = new javax.swing.JButton();

jButton7 = new javax.swing.JButton();

jButton8 = new javax.swing.JButton();

jButton9 = new javax.swing.JButton();

jButton10 = new javax.swing.JButton();

jButton11 = new javax.swing.JButton();

jButton12 = new javax.swing.JButton();

jButton13 = new javax.swing.JButton();

jLabel5 = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();


jLabel7 = new javax.swing.JLabel();

cinepolis = new javax.swing.JLabel();

movieName = new javax.swing.JLabel();

jLabel1 = new javax.swing.JLabel();

jButton1 = new javax.swing.JButton();

jLabel8 = new javax.swing.JLabel();

jLabel9 = new javax.swing.JLabel();

datebox = new javax.swing.JComboBox<>();

jButton14 = new javax.swing.JButton();

jButton15 = new javax.swing.JButton();

jButton16 = new javax.swing.JButton();

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=pvr.getText();

String time=jButton5.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);


}

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(pvr.getText());

ts.Time.setText(jButton5.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=pvr.getText();

String time=jButton4.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {


Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(pvr.getText());

ts.Time.setText(jButton4.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=inox.getText();

String time=jButton8.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);
} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(inox.getText());

ts.Time.setText(jButton8.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=inox.getText();

String time=jButton9.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

{
Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(inox.getText());

ts.Time.setText(jButton9.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=inox.getText();

String time=jButton6.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)
{

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(inox.getText());

ts.Time.setText(jButton6.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=inox.getText();

String time=jButton7.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

}
catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(inox.getText());

ts.Time.setText(jButton7.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=cinepolis.getText();

String time=jButton10.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();
}

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(cinepolis.getText());

ts.Time.setText(jButton10.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=cinepolis.getText();

String time=jButton11.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");
pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(cinepolis.getText());

ts.Time.setText(jButton11.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=cinepolis.getText();

String time=jButton12.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");
PreparedStatement pst=con.prepareStatement("update moviefake set
theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(cinepolis.getText());

ts.Time.setText(jButton12.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=cinepolis.getText();

String time=jButton13.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(cinepolis.getText());

ts.Time.setText(jButton13.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();

String theatre=pvr.getText();

String time=jButton2.getText();

String selected=datebox.getSelectedItem().toString();
Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

//pst=con.prepareStatement("select * from moviefake where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(pvr.getText());

ts.Time.setText(jButton2.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

else

try

String username=jLabel8.getText();
String theatre=pvr.getText();

String time=jButton3.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

total_seat ts=new total_seat();

String selected=datebox.getSelectedItem().toString();

ts.Date.setText(selected);

ts.Movie.setText(movieName.getText());

ts.Theatre.setText(pvr.getText());

ts.Time.setText(jButton3.getText());

ts.jLabel4.setText(jLabel8.getText());

ts.setVisible(true);

}// TODO add your handling code here:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

setVisible(false);

choose_movie cm=new choose_movie();

cm.jLabel4.setText(jLabel8.getText());

cm.setVisible(true);// TODO add your handling code here:

private void dateboxActionPerformed(java.awt.event.ActionEvent evt) {

}
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {

setVisible(false);

PVR P=new PVR();

P.Movie.setText(movieName.getText());

P.jLabel4.setText(jLabel8.getText());

P.setVisible(true);

private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {

setVisible(false);

INOX I=new INOX();

I.Movie.setText(movieName.getText());

I.jLabel4.setText(jLabel8.getText());

I.setVisible(true);

private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {

setVisible(false);

CINEPOLIS C=new CINEPOLIS();

C.Movie.setText(movieName.getText());

C.jLabel4.setText(jLabel8.getText());

C.setVisible(true);

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(choose_theatre.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(choose_theatre.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(choose_theatre.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(choose_theatre.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new choose_theatre().setVisible(true);

});

// Variables declaration - do not modify

public javax.swing.JLabel cinepolis;

public javax.swing.JComboBox<String> datebox;

public javax.swing.JLabel inox;

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton10;

private javax.swing.JButton jButton11;

private javax.swing.JButton jButton12;

private javax.swing.JButton jButton13;

private javax.swing.JButton jButton14;

private javax.swing.JButton jButton15;

private javax.swing.JButton jButton16;

private javax.swing.JButton jButton2;

private javax.swing.JButton jButton3;


private javax.swing.JButton jButton4;

private javax.swing.JButton jButton5;

private javax.swing.JButton jButton6;

private javax.swing.JButton jButton7;

private javax.swing.JButton jButton8;

private javax.swing.JButton jButton9;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel jLabel7;

public javax.swing.JLabel jLabel8;

private javax.swing.JLabel jLabel9;

private javax.swing.JPanel jPanel1;

public javax.swing.JLabel movieName;

public javax.swing.JLabel pvr;

// End of variables declaration

MINIMIZED CODE:

3) NAME:

1.2) Variable Name


Renaming variables is the process of changing the names of variables in a program's source
code to make the code more readable, maintainable, or to adhere to specific naming
conventions.

Existing Code:
jPanel1 = new javax.swing.JPanel();

pvr = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jButton2 = new javax.swing.JButton();

jButton3 = new javax.swing.JButton();

jButton4 = new javax.swing.JButton();

jButton5 = new javax.swing.JButton();

inox = new javax.swing.JLabel();


jLabel4 = new javax.swing.JLabel();

jButton6 = new javax.swing.JButton();

jButton7 = new javax.swing.JButton();

jButton8 = new javax.swing.JButton();

jButton9 = new javax.swing.JButton();

jButton10 = new javax.swing.JButton();

jButton11 = new javax.swing.JButton();

jButton12 = new javax.swing.JButton();

jButton13 = new javax.swing.JButton();

jLabel5 = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

jLabel7 = new javax.swing.JLabel();

cinepolis = new javax.swing.JLabel();

movieName = new javax.swing.JLabel();

jLabel1 = new javax.swing.JLabel();

jButton1 = new javax.swing.JButton();

jLabel8 = new javax.swing.JLabel();

jLabel9 = new javax.swing.JLabel();

datebox = new javax.swing.JComboBox<>();

jButton14 = new javax.swing.JButton();

jButton15 = new javax.swing.JButton();

jButton16 = new javax.swing.JButton();

Changed Code:
panel1 = new javax.swing.JPanel();

pvrLabel = new javax.swing.JLabel();

label2 = new javax.swing.JLabel();

button2 = new javax.swing.JButton();

button3 = new javax.swing.JButton();

button4 = new javax.swing.JButton();

button5 = new javax.swing.JButton();

inoxLabel = new javax.swing.JLabel();

label4 = new javax.swing.JLabel();

button6 = new javax.swing.JButton();

button7 = new javax.swing.JButton();

button8 = new javax.swing.JButton();

button9 = new javax.swing.JButton();


button10 = new javax.swing.JButton();

button11 = new javax.swing.JButton();

button12 = new javax.swing.JButton();

button13 = new javax.swing.JButton();

label5 = new javax.swing.JLabel();

label6 = new javax.swing.JLabel();

label7 = new javax.swing.JLabel();

cinepolisLabel = new javax.swing.JLabel();

movieNameLabel = new javax.swing.JLabel();

label1 = new javax.swing.JLabel();

button1 = new javax.swing.JButton();

label8 = new javax.swing.JLabel();

label9 = new javax.swing.JLabel();

dateComboBox = new javax.swing.JComboBox<>();

button14 = new javax.swing.JButton();

button15 = new javax.swing.JButton();

button16 = new javax.swing.JButton();

1.2 Function Name


Renaming function names is the process of changing the names of functions or methods in a
program's source code. Just like renaming variables, renaming function names is done to
improve code readability, maintainability, and consistency.
Existing Code:
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

try

String username=jLabel8.getText();

String theatre=pvr.getText();

String time=jButton5.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");
PreparedStatement pst=con.prepareStatement("update moviefake set
theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

Changed Code:
private void DATEActionPerformed(java.awt.event.ActionEvent evt) {

if(datebox.getSelectedItem()=="SELECT DATE")

invalidDate id=new invalidDate();

id.setVisible(true);

try

String username=jLabel8.getText();

String theatre=pvr.getText();

String time=jButton5.getText();

String selected=datebox.getSelectedItem().toString();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


theatre='"+theatre+"',time='"+time+"',date='"+selected+"' where username='"+username+"'");

pst.executeUpdate();

2) Consistency & Idioms

Consistent indentation and brace style are essential for writing clean and readable
code. They make your code more understandable and maintainable, not only by you
but also by other developers who may work on the code.
Existing Code:
catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);}

catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);}

Changed Code:
catch(SQLException ex)

{
Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

catch (ClassNotFoundException ex)

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

Average case , best case and worst case :


Here are the best, average, and worst-case complexities for the provided code:
Best Case:

The best-case scenario would be when all database operations execute without any errors, and
the application runs smoothly. In this case, the time complexity of each button click is O(1)
because the database update is expected to be fast, and there are no exceptions.
Average Case:

The average-case scenario would depend on factors such as the database load, network
latency, and the server's performance. It's difficult to specify a precise time complexity, but it
is often considered to be O(1) or O(log N) for well-optimized databases. However, in
practice, it may be influenced by external factors.
Worst Case:

The worst-case scenario would be when database operations encounter errors or slow
performance. In this case, the time complexity is driven by the worst-case performance of the
database operations. For example, if there are issues with the database server, network, or
database design, the time complexity might be O(N) or even worse, where N is the number of
records in the database. If there's a significant amount of data in the database, updating all
records can be time-consuming.

Pseudocode:
Class choose_movie:
Method choose_movie():
Initialize GUI components
Call initComponents()

Method initComponents():
// Initialize the GUI components such as buttons, labels, and panels
// Set up the layout and appearance of the JFrame
Method updateMovieSelection(movie):
Try:
Get the username from jLabel4
Establish a database connection
Prepare a SQL statement to update the movie selection for the user
Set the movie and username as parameters in the SQL statement
Execute the SQL statement to update the database
Catch SQLException or ClassNotFoundException:
Log any errors

Hide the current window


Call openChooseTheatre(movie)

Method openChooseTheatre(movie):
Create an instance of the choose_theatre class
Set the movie name and username labels in the choose_theatre window
Display the choose_theatre window

Method movieButtonActionPerformed(evt, movie):


Call updateMovieSelection(movie) when a movie button is clicked

Method main(args):
Set the look and feel for the UI
Create an instance of the choose_movie class
Display the choose_movie window

Main program:
Call the main method to start the application
Defensive Programming Techniques:

1. Exception Handling:
- Exception handling is used throughout the code using `try-catch` blocks. It helps to catch
and handle exceptions that may occur during database operations, preventing the application
from crashing.

Apply 10 Techniques For Exceptional Handling


try {
String username = jLabel8.getText();
String theatre = pvr.getText();
String time = jButton5.getText();
String selected = datebox.getSelectedItem().toString();

// Database operations
Class.forName("com.mysql.jdbc.Driver");
try (Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/movie",
"root", "");
PreparedStatement pst = con.prepareStatement("update moviefake set theatre=?,
time=?, date=? where username=?")) {

// Set parameters using PreparedStatement


pst.setString(1, theatre);
pst.setString(2, time);
pst.setString(3, selected);
pst.setString(4, username);

// Execute the update


pst.executeUpdate();

// Commit the transaction


con.commit();
}
} catch (SQLException ex) {
1. Logging the Exception:
Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE, null, ex);

2. Rethrowing the Exception:


throw new RuntimeException("Database operation failed", ex);

3. Custom Error Handling or User Notification:


// Notify the user about the failure or take specific actions

4. Graceful Error Handling or Recovery Mechanism:


// Attempt a recovery mechanism if possible

5. Exception Suppression:
// No suppression applied in this example

} finally {
6. Use of Finally Block:
// Ensure resources are closed, even if an exception occurs
// Close connections, statements, etc.
}
7. Specific Exception Handling with Different Actions:
// Catch specific types of SQLException and handle differently

8. Nested Try-Catch Blocks:


// For more granular handling, consider nesting try-catch blocks

9. Error Reporting and User Feedback:


// Provide specific error messages to the user
10. Contingency Planning with Default Behavior:
// Define default behaviors or fallback options in case of failures

2. Protecting your program from Invalid Inputs :


- Input validation is used to ensure that user-provided data is in the expected format and
range and and in this module no input field are used.
3. Error Handling:
- The code displays error messages using `JOptionPane` to inform the user about issues or
incorrect inputs, providing a better user experience and in this module No error handling are
used.
4.Assertions:
- No assertions are used in my module.
PAYMENT MODULE:
Interface:

Existing Code:
import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.SQLException;

import java.util.logging.Level;

import java.util.logging.Logger;

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/
/**

* @author kaush

*/

public class paymentNew extends javax.swing.JFrame {

/**

* Creates new form paymentNew

*/

public paymentNew() {

initComponents();

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jPanel1 = new javax.swing.JPanel();

jLabel15 = new javax.swing.JLabel();

amount = new javax.swing.JLabel();

jRadioButton1 = new javax.swing.JRadioButton();

jLabel17 = new javax.swing.JLabel();

jRadioButton2 = new javax.swing.JRadioButton();

jLabel18 = new javax.swing.JLabel();

jLabel19 = new javax.swing.JLabel();

jRadioButton3 = new javax.swing.JRadioButton();

jLabel21 = new javax.swing.JLabel();

jRadioButton4 = new javax.swing.JRadioButton();

theatreName = new javax.swing.JLabel();


jLabel20 = new javax.swing.JLabel();

jLabel1 = new javax.swing.JLabel();

jLabel22 = new javax.swing.JLabel();

SEAT = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

jLabel7 = new javax.swing.JLabel();

date = new javax.swing.JLabel();

time = new javax.swing.JLabel();

jLabel10 = new javax.swing.JLabel();

jLabel11 = new javax.swing.JLabel();

total = new javax.swing.JLabel();

movieLabel = new javax.swing.JLabel();

jLabel13 = new javax.swing.JLabel();

jLabel14 = new javax.swing.JLabel();

jLabel23 = new javax.swing.JLabel();

jButton1 = new javax.swing.JButton();

rows = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

user = new javax.swing.JLabel();

jLabel9 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jPanel1.setBackground(new java.awt.Color(0, 0, 0));

jLabel15.setForeground(new java.awt.Color(255, 0, 51));

jLabel15.setText("Amount Payable :");

amount.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N

amount.setForeground(new java.awt.Color(255, 255, 255));

amount.setText("440.20");

jRadioButton1.setBackground(new java.awt.Color(0, 0, 0));

jRadioButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {

jRadioButton1MouseClicked(evt);

});

jRadioButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jRadioButton1ActionPerformed(evt);

});

jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/movie/ticket/booking/Google_Pay-
Logo.wine.png"))); // NOI18N

jLabel17.setText("jLabel17");

jRadioButton2.setBackground(new java.awt.Color(0, 0, 0));

jRadioButton2.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jRadioButton2ActionPerformed(evt);

});

jLabel18.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel18.setForeground(new java.awt.Color(255, 255, 255));

jLabel18.setText("Select Payment Method:");

jLabel19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/movie/ticket/booking/Paytm-
Logo.wine.png"))); // NOI18N

jLabel19.setText("jLabel19");

jRadioButton3.setBackground(new java.awt.Color(0, 0, 0));

jRadioButton3.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jRadioButton3ActionPerformed(evt);

});
jLabel21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/movie/ticket/booking/bhim-upi-
icon.png"))); // NOI18N

jLabel21.setText("jLabel21");

jRadioButton4.setBackground(new java.awt.Color(0, 0, 0));

jRadioButton4.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jRadioButton4ActionPerformed(evt);

});

theatreName.setForeground(new java.awt.Color(255, 0, 51));

theatreName.setText("PVR: silk mill,Gandhi Nagar(AUDI 04)");

jLabel20.setFont(new java.awt.Font("Tahoma", 1, 15)); // NOI18N

jLabel20.setForeground(new java.awt.Color(255, 255, 255));

jLabel20.setText("CREDIT/DEBIT CARD");

jLabel1.setFont(new java.awt.Font("Verdana", 0, 18)); // NOI18N

jLabel1.setForeground(new java.awt.Color(255, 0, 51));

jLabel1.setText("ORDER SUMMARY");

jLabel22.setFont(new java.awt.Font("Tahoma", 0, 48)); // NOI18N

jLabel22.setForeground(new java.awt.Color(255, 255, 255));

jLabel22.setText("PAYMENT WINDOW");

SEAT.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N

SEAT.setForeground(new java.awt.Color(255, 255, 255));

SEAT.setText("2");

jLabel6.setForeground(new java.awt.Color(255, 0, 51));

jLabel6.setText("Tickets");

jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N


jLabel7.setForeground(new java.awt.Color(255, 255, 255));

jLabel7.setText("PRIME - ");

date.setForeground(new java.awt.Color(255, 255, 255));

date.setText("Fri, 21 Oct,2022");

time.setForeground(new java.awt.Color(255, 255, 255));

time.setText("11:30 AM");

jLabel10.setForeground(new java.awt.Color(255, 255, 255));

jLabel10.setText("---------------------------------------------------------------------------------------- ");

jLabel11.setForeground(new java.awt.Color(255, 0, 51));

jLabel11.setText("Sub Total");

total.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

total.setForeground(new java.awt.Color(255, 255, 255));

total.setText("Rs. 381.56");

movieLabel.setForeground(new java.awt.Color(255, 255, 255));

movieLabel.setText("SARDAR(Tamil)(U/A)");

jLabel13.setForeground(new java.awt.Color(255, 0, 51));

jLabel13.setText("+Convenience fees");

jLabel14.setForeground(new java.awt.Color(255, 255, 255));

jLabel14.setText("Rs. 58");

jLabel23.setText("jLabel23");

jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/movie/ticket/booking/back button


rezise.png"))); // NOI18N

jButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton1ActionPerformed(evt);
}

});

rows.setBackground(new java.awt.Color(0, 0, 0));

rows.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

rows.setForeground(new java.awt.Color(255, 255, 255));

rows.setText("jLabel2");

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N

jLabel2.setForeground(new java.awt.Color(255, 255, 255));

jLabel2.setText("Rs.");

user.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

user.setForeground(new java.awt.Color(255, 0, 0));

user.setText(" ");

private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {

try

String username=user.getText();

String amt=amount.getText();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


amount='Rs."+amt+"',payment_method='GPAY' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

gpay gp=new gpay();

gp.DATE.setText(date.getText());
gp.TIME.setText(time.getText());

gp.THEATRE.setText(theatreName.getText());

gp.TOTAL.setText(amount.getText());

gp.ROWS.setText(rows.getText());

gp.TICKETS.setText(SEAT.getText());

gp.MOVIE.setText(movieLabel.getText());

gp.user.setText(user.getText());

gp.setVisible(true);//setVisible(false);*/

//gpay_paytm obj=new gpay();

//obj.setVisible(true);// TODO add your handling code here:

private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {

try

String username=user.getText();

String amt=amount.getText();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


amount='Rs."+amt+"',payment_method='PAYTM' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

paytm gp=new paytm();

gp.DATE.setText(date.getText());

gp.TIME.setText(time.getText());

gp.THEATRE.setText(theatreName.getText());

gp.TOTAL.setText(amount.getText());
gp.ROWS.setText(rows.getText());

gp.TICKETS.setText(SEAT.getText());

gp.MOVIE.setText(movieLabel.getText());

gp.user.setText(user.getText());

gp.setVisible(true); // TODO add your handling code here:

private void jRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {

try

String username=user.getText();

String amt=amount.getText();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


amount='Rs."+amt+"',payment_method='CREDIT/DEBIT CARD' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

credit_debit gp=new credit_debit();

gp.DATE.setText(date.getText());

gp.TIME.setText(time.getText());

gp.THEATRE.setText(theatreName.getText());

gp.TOTAL.setText(amount.getText());

gp.rows.setText(rows.getText());

gp.TICKETS.setText(SEAT.getText());

gp.MOVIE.setText(movieLabel.getText());

gp.user.setText(user.getText());

gp.setVisible(true);// TODO add your handling code here:


}

private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {

try

String username=user.getText();

String amt=amount.getText();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


amount='Rs."+amt+"',payment_method='UPI' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

setVisible(false);

upi gp=new upi();

gp.DATE.setText(date.getText());

gp.TIME.setText(time.getText());

gp.THEATRE.setText(theatreName.getText());

gp.ROWS.setText(rows.getText());

gp.TOTAL.setText(amount.getText());

gp.TICKETS.setText(SEAT.getText());

gp.MOVIE.setText(movieLabel.getText());

gp.user.setText(user.getText());

gp.setVisible(true);// TODO add your handling code here:

private void jRadioButton1MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

setVisible(false);

priceCalculate p=new priceCalculate();

p.rows.setText(rows.getText());

p.Seat.setText(SEAT.getText());

p.Time.setText(time.getText());

p.Movie.setText(movieLabel.getText());

p.Total.setText(total.getText());

p.Theatre.setText(theatreName.getText());

p.jLabel4.setText(user.getText());

p.Date.setText(date.getText());

p.setVisible(true);// TODO add your handling code here:

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(paymentNew.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(paymentNew.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(paymentNew.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(paymentNew.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new paymentNew().setVisible(true);

});

MINIMIZED CODE:
4) NAME:

1.3) Variable Name


Renaming variables is the process of changing the names of variables in a program's source
code to make the code more readable, maintainable, or to adhere to specific naming
conventions.
Existing Code:
jPanel1 = new javax.swing.JPanel();

jLabel15 = new javax.swing.JLabel();

amount = new javax.swing.JLabel();

jRadioButton1 = new javax.swing.JRadioButton();

jLabel17 = new javax.swing.JLabel();

jRadioButton2 = new javax.swing.JRadioButton();

jLabel18 = new javax.swing.JLabel();


jLabel19 = new javax.swing.JLabel();

jRadioButton3 = new javax.swing.JRadioButton();

jLabel21 = new javax.swing.JLabel();

jRadioButton4 = new javax.swing.JRadioButton();

theatreName = new javax.swing.JLabel();

jLabel20 = new javax.swing.JLabel();

jLabel1 = new javax.swing.JLabel();

jLabel22 = new javax.swing.JLabel();

SEAT = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

jLabel7 = new javax.swing.JLabel();

date = new javax.swing.JLabel();

time = new javax.swing.JLabel();

jLabel10 = new javax.swing.JLabel();

jLabel11 = new javax.swing.JLabel();

total = new javax.swing.JLabel();

movieLabel = new javax.swing.JLabel();

jLabel13 = new javax.swing.JLabel();

jLabel14 = new javax.swing.JLabel();

jLabel23 = new javax.swing.JLabel();

jButton1 = new javax.swing.JButton();

rows = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

user = new javax.swing.JLabel();

jLabel9 = new javax.swing.JLabel();

Changed Code:
panel = new javax.swing.JPanel();

movieTitleLabel = new javax.swing.JLabel();

amountLabel = new javax.swing.JLabel();

radioButton1 = new javax.swing.JRadioButton();

seatTypeLabel = new javax.swing.JLabel();

radioButton2 = new javax.swing.JRadioButton();


theaterLabel = new javax.swing.JLabel();

radioButton3 = new javax.swing.JRadioButton();

dateLabel = new javax.swing.JLabel();

radioButton4 = new javax.swing.JRadioButton();

timeLabel = new javax.swing.JLabel();

theaterNameLabel = new javax.swing.JLabel();

ticketLabel = new javax.swing.JLabel();

seatLabel = new javax.swing.JLabel();

totalAmountLabel = new javax.swing.JLabel();

movieNameLabel = new javax.swing.JLabel();

ticketDetailsLabel = new javax.swing.JLabel();

ticketInfoLabel = new javax.swing.JLabel();

backButton = new javax.swing.JLabel();

rowCountLabel = new javax.swing.JLabel();

userLabel = new javax.swing.JLabel();

userDetailsLabel = new javax.swing.JLabel();

confirmButton = new javax.swing.JButton();

1.2)Function Name
Renaming function names is the process of changing the names of functions or methods in a
program's source code. Just like renaming variables, renaming function names is done to
improve code readability, maintainability, and consistency.
Existing Code:
private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {

try

String username=user.getText();

String amt=amount.getText();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


amount='Rs."+amt+"',payment_method='PAYTM' where username='"+username+"'");

pst.executeUpdate();

}
catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

Changed Code:
private void PAYTMActionPerformed(java.awt.event.ActionEvent evt) {

try

String username=user.getText();

String amt=amount.getText();

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/movie","root","");

PreparedStatement pst=con.prepareStatement("update moviefake set


amount='Rs."+amt+"',payment_method='PAYTM' where username='"+username+"'");

pst.executeUpdate();

catch(SQLException ex)

Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE,null,ex);

} catch (ClassNotFoundException ex) {

Logger.getLogger(choose_movie.class.getName()).log(Level.SEVERE, null, ex);

2)Consistency & Idioms

Consistent indentation and brace style are essential for writing clean and readable
code. They make your code more understandable and maintainable, not only by you
but also by other developers who may work on the code.
Existing Code:
try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;

}}

Changed Code:
try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels())

if ("Nimbus".equals(info.getName()))

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

Best case and worst case :


Here are the best, average, and worst-case complexities for the provided code:
1. Best Case Complexity:
The best-case complexity would occur when everything goes smoothly without any exceptions
being thrown.In this case, the code will run through the four radio button actions
(`jRadioButton1ActionPerformed`, `jRadioButton2ActionPerformed`,
`jRadioButton3ActionPerformed`, and `jRadioButton4ActionPerformed`) and execute the
corresponding SQL queries.The time complexity of these operations is typically O(1) as they involve
updating a single record in the database.The `setVisible(false)` operations and opening new frames
have negligible time complexity in this context.
So, the best-case time complexity of the code is O(1).

2. Worst Case Complexity:


The worst-case complexity will occur when an exception is thrown in all four radio button
actions.In this case, the code will catch exceptions for each payment method, which involves setting
up database connections and executing SQL queries.Opening and setting up new frames with data to
be passed will also contribute to the complexity.The time complexity for the database operations,
including handling exceptions, is O(1) because, in the worst case, you are still updating a single
record for each payment method.
So, the worst-case time complexity of the code is O(1) for each radio button action.
However, since there are four different radio button actions, the worst-case time complexity will be
O(4) or simply O(1) since it's a constant factor.
Pseudocode:
Create a class named "paymentNew" which extends javax.swing.JFrame

Create a constructor for "paymentNew"

Initialize and create GUI components

Create a method "jRadioButton1ActionPerformed" which takes an ActionEvent as a parameter

Try

Get the "username" and "amt" from the form

Load the MySQL JDBC driver

Establish a database connection

Prepare a SQL statement to update payment information with "GPAY" method

Execute the SQL statement

Catch SQLException

Log the error

Catch ClassNotFoundException

Log the error

Hide the current window

Create a new window for "gpay"

Set the necessary details in the new window

Make the new window visible

Create a method "jRadioButton2ActionPerformed" which takes an ActionEvent as a parameter

Try

Get the "username" and "amt" from the form

Load the MySQL JDBC driver

Establish a database connection

Prepare a SQL statement to update payment information with "PAYTM" method

Execute the SQL statement

Catch SQLException

Log the error

Catch ClassNotFoundException

Log the error

Hide the current window

Create a new window for "paytm"


Set the necessary details in the new window

Make the new window visible

Create a method "jRadioButton3ActionPerformed" which takes an ActionEvent as a parameter

Try

Get the "username" and "amt" from the form

Load the MySQL JDBC driver

Establish a database connection

Prepare a SQL statement to update payment information with "CREDIT/DEBIT CARD" method

Execute the SQL statement

Catch SQLException

Log the error

Catch ClassNotFoundException

Log the error

Hide the current window

Create a new window for "credit_debit"

Set the necessary details in the new window

Make the new window visible

Create a method "jRadioButton4ActionPerformed" which takes an ActionEvent as a parameter

Try

Get the "username" and "amt" from the form

Load the MySQL JDBC driver

Establish a database connection

Prepare a SQL statement to update payment information with "UPI" method

Execute the SQL statement

Catch SQLException

Log the error

Catch ClassNotFoundException

Log the error

Hide the current window

Create a new window for "upi"


Defensive Programming Techniques:

1. Exception Handling:
- Exception handling is used throughout the code using `try-catch` blocks. It helps to catch
and handle exceptions that may occur during database operations, preventing the application
from crashing.
Apply 10 Techniques For Exceptional Handling
1. Logging the Exception:
try {
String username = user.getText();
String amt = amount.getText();
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/movie",
"root", "");
PreparedStatement pst = con.prepareStatement("update moviefake set amount='Rs." + amt
+ "',payment_method='GPAY' where username='" + username + "'");
pst.executeUpdate();
} catch (SQLException ex) {
// Logging the exception
Logger.getLogger(Newuser.class.getName()).log(Level.SEVERE, null, ex);
}

2. Rethrowing the Exception:


try {
// Code block...
} catch (SQLException ex) {
// Rethrowing the exception as a new runtime exception
throw new RuntimeException("Error updating movie details", ex);
}

3. Custom Error Handling or User Notification:


try {
// Code block...
} catch (SQLException ex) {
// Custom error handling or user notification
// e.g., Display an error message to the user
System.err.println("Error: " + ex.getMessage());
}

4. Graceful Error Handling or Recovery Mechanism:


try {
// Code block...
} catch (SQLException ex) {
// Graceful error handling or recovery mechanism
// e.g., Rollback changes in case of a database error
con.rollback();
}

5. Use of Finally Block:


try {
// Code block...
} catch (SQLException ex) {
// Exception handling
} finally {
// Cleanup or resource release code in a finally block
// e.g., Close the connection or release resources
}

6. Exception Suppression:
try {
// Code block...
} catch (SQLException ex) {
// Handling SQLException
} catch (Exception ex) {
// Handling other exceptions and possibly suppressing the original exception
ex.printStackTrace(); // Suppressing the exception
}

7. Specific Exception Handling with Different Actions:


try {
// Code block...
} catch (SQLException ex) {
// Handling SQLException with specific actions
} catch (SomeOtherException ex) {
// Handling SomeOtherException differently
}
8. Nested Try-Catch Blocks:
try {
// Code block...
} catch (SQLException ex) {
try {
// Nested try-catch for more specific handling or recovery
// ...
} catch (Exception nestedEx) {
// Handling exceptions within the nested block
}
}
9. Error Reporting and User Feedback:
try {
// Code block...
} catch (SQLException ex) {
// Error reporting to the user
System.err.println("Error: " + ex.getMessage());
}

10. Contingency Planning with Default Behavior:


try {
// Code block...
} catch (SQLException ex) {
// If an exception occurs, perform a default action or revert changes
// e.g., Log the error and revert to a previous state
}

2. Protecting your program from Invalid Inputs :


- Input validation is used to ensure that user-provided data is in the expected format and range
and and if don’t select any of the radiobutton and click pay then pay will not be processed.
3. Error Handling:
The code displays error messages using `JOptionPane` to inform the user about issues or
incorrect inputs, providing a better user experience and an error message is displayed if any
of the payment method is not selected and pay is clicked.
4.Assertions:
- No assertions are used in my module.
TICKET MODULE:
Interface:

Existing Code:

public class ticket extends javax.swing.JFrame {


public ticket() {
initComponents();
}
@SuppressWarnings("unchecked")
private void initComponents() {

jPanel1 = new javax.swing.JPanel();


jLabel1 = new javax.swing.JLabel();
Movie = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
Theatre = new javax.swing.JLabel();
Date = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
Time = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
Total = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
Tickets = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
ROWS = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jPanel1.setBackground(new java.awt.Color(0, 0, 0));

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N


jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Your Ticket ");

Movie.setFont(new java.awt.Font("Trebuchet MS", 1, 24)); // NOI18N


Movie.setForeground(new java.awt.Color(255, 255, 255));
Movie.setText("SARDAR(Tamil)(U/A)");

jLabel5.setForeground(new java.awt.Color(255, 255, 255));


jLabel5.setText("Ticket(s)");

Theatre.setForeground(new java.awt.Color(255, 255, 255));


Theatre.setText("PVR:silk mill ,Gandhi Nagar(AUDI 04)");

Date.setForeground(new java.awt.Color(255, 0, 0));


Date.setText("Fri,21 OCT,2022");
jLabel8.setForeground(new java.awt.Color(255, 0, 0));
jLabel8.setText("PRIME-");

Time.setForeground(new java.awt.Color(255, 0, 0));


Time.setText("11:30");

jLabel9.setForeground(new java.awt.Color(255, 255, 255));


jLabel9.setText("----------------------------------------------------------");

jLabel10.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N


jLabel10.setForeground(new java.awt.Color(255, 0, 0));
jLabel10.setText("Amount paid:");

Total.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N


Total.setForeground(new java.awt.Color(255, 255, 255));
Total.setText("Rs.440.20");

jLabel12.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/movie/ticket/booking/white qr.png")));
jLabel12.setText("jLabel12");

Tickets.setFont(new java.awt.Font("Times New Roman", 1, 18));


Tickets.setForeground(new java.awt.Color(255, 255, 255));
Tickets.setText("2");

jLabel2.setForeground(new java.awt.Color(255, 0, 0));


jLabel2.setText("Please Show the QR Code Image\n at the Cinema Entrance");

ROWS.setForeground(new java.awt.Color(255, 0, 0));


ROWS.setText("jLabel3");

jButton1.setForeground(new java.awt.Color(255, 0, 0));


jButton1.setText("Share");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
jButton1ActionPerformed(evt)
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(352, 352, 352)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 155,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(88, 88, 88)
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 219,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(189, 189, 189)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ROWS)
.addGap(94, 94, 94)
.addComponent(Tickets)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 87,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(Date)
.addComponent(Time)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jPanel1Layout.createSequentialGroup()
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 121,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(61, 61, 61)
.addComponent(Total, javax.swing.GroupLayout.PREFERRED_SIZE, 102,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 310,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(jLabel2)
.addGap(128, 128, 128)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Movie, javax.swing.GroupLayout.PREFERRED_SIZE, 360,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Theatre))))
.addContainerGap(27, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(219, 219, 219))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 77,
Short.MAX_VALUE)
.addComponent(Movie)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(Theatre, javax.swing.GroupLayout.PREFERRED_SIZE, 14,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(57, 57, 57)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Tickets)
.addComponent(ROWS))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Date)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Time)
.addGap(61, 61, 61)
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Total, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(49, 49, 49)
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 196,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(51, 51, 51)
.addComponent(jButton1)
.addGap(0, 56, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(109, 109, 109)
.addComponent(jLabel2)
.addGap(0, 0, Short.MAX_VALUE))))
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());


getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);

pack();
setLocationRelativeTo(null);
}// </editor-fold>

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {


setVisible(false);
share obj=new share();
obj.setVisible(true);// TODO add your handling code here:
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ticket().setVisible(true);
}
});
}
// Variables declaration - do not modify
public javax.swing.JLabel Date;
public javax.swing.JLabel Movie;
public javax.swing.JLabel ROWS;
public javax.swing.JLabel Theatre;
public javax.swing.JLabel Tickets;
public javax.swing.JLabel Time;
public javax.swing.JLabel Total;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
// End of variables declaration

MINIMIZED CODE:
3) NAME:

7.1) Variable Name


Renaming variables is the process of changing the names of variables in a program's source
code to make the code more readable, maintainable, or to adhere to specific naming
conventions.
Existing Code:
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
Movie = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
Theatre = new javax.swing.JLabel();
Date = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
Time = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
Total = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
Tickets = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
ROWS = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();

Changed Code:
Panel = new javax.swing.JPanel();
headLabel = new javax.swing.JLabel();
movieLabel = new javax.swing.JLabel();
ticketCountLabel = new javax.swing.JLabel();
theatreLabel = new javax.swing.JLabel();
dateLabel = new javax.swing.JLabel();
primeLabel = new javax.swing.JLabel();
timeLabel = new javax.swing.JLabel();
separatorLabel = new javax.swing.JLabel();
amountPaidLabel = new javax.swing.JLabel();
totalAmountLabel = new javax.swing.JLabel();
qrCodeLabel = new javax.swing.JLabel();
ticketCountValueLabel = new javax.swing.JLabel();
showQrCodeLabel = new javax.swing.JLabel();
rowsLabel = new javax.swing.JLabel();
shareButton = new javax.swing.JButton();

7.2) Function Name


Renaming function names is the process of changing the names of functions or methods in a
program's source code. Just like renaming variables, renaming function names is done to
improve code readability, maintainability, and consistency.

Existing Code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
setVisible(false);
share obj=new share();
obj.setVisible(true);// TODO add your handling code here:
}

Changed Code:
private void shareButtonActionPerformed(java.awt.event.ActionEvent evt) {
setVisible(false);
ShareWindow share = new ShareWindow();
share.setVisible(true);
}

4) Consistency & Idioms

Consistent indentation and brace style are essential for writing clean and readable
code. They make your code more understandable and maintainable, not only by you
but also by other developers who may work on the code.
Existing Code:
public void actionPerformed(java.awt.event.ActionEvent evt)
shareButtonActionPerformed(evt);
});
Changed Code:
public void actionPerformed(java.awt.event.ActionEvent evt)
{
shareButtonActionPerformed(evt);
}
});

Average case , best case and worst case :

Here are the best, average, and worst-case complexities for the provided code:
Best Case:
The best-case complexity of this code is O(1) because it represents the time complexity when the code
execution follows the optimal path with the least number of operations. In this case, it assumes that all
GUI components are efficiently created and displayed, and there are no unexpected issues or errors
during execution.
Average Case:
The average-case complexity for GUI code like this can be challenging to precisely determine. It
depends on various factors such as the complexity of the GUI layout, the number of components, and
the specific behavior of the user interface. On average, it can be considered to be between O(n) and
O(n^2), where n represents the number of GUI components. This is because the time complexity
generally scales with the number of components and their interdependencies.
Worst Case:
The worst-case complexity of this code is O(n^2) because it represents the time complexity when the
code execution faces the most unfavorable conditions. In this case, it assumes that the layout manager
and component rendering encounter their worst-case behavior, leading to a quadratic increase in the
number of operations as the number of GUI components (n) increases.

Pseudocode:

Create a class named Ticket that extends javax.swing.JFrame

Define a constructor for the Ticket class:


Initialize the frame components by calling the initComponents method

Define the initComponents method:


Create a JPanel named jPanel1
Create a JLabel named jLabel1 with text "Your Ticket"
Create a JLabel named Movie with text "SARDAR(Tamil)(U/A)"
Create a JLabel named jLabel5 with text "Ticket(s)"
Create a JLabel named Theatre with text "PVR:silk mill, Gandhi Nagar(AUDI 04)"
Create a JLabel named Date with text "Fri, 21 OCT, 2022"
Create a JLabel named jLabel8 with text "PRIME-"
Create a JLabel named Time with text "11:30"
Create a JLabel named jLabel9 with a line separator
Create a JLabel named jLabel10 with text "Amount paid:"
Create a JLabel named Total with text "Rs.440.20"
Create a JLabel named jLabel12 with an image
Create a JLabel named Tickets with text "2"
Create a JLabel named jLabel2 with instructions
Create a JLabel named ROWS
Create a JButton named jButton1 with text "Share"

Set the default close operation of the frame to EXIT_ON_CLOSE


Set the background color of jPanel1 to black

Define a GroupLayout named jPanel1Layout for jPanel1


Configure the horizontal and vertical layout of jPanel1Layout to arrange components

Define a GroupLayout named layout for the content pane of the frame
Set the layout of the content pane to layout

Pack the frame


Set the location of the frame to the center of the screen

Define an actionPerformed method for jButton1:


Hide the current frame
Create an instance of the Share class and make it visible

Define a main method:


Execute the Ticket class within the EventQueue.invokeLater method to create and display the frame
Create an inner class named Share that extends JFrame
(You can define the Share window components and behavior here)

Define variables for JLabels, JButton, and JPanel

Defensive Programming Techniques:

1. Exception Handling:
- Exception handling is used throughout the code using `try-catch` blocks. It helps to catch
and handle exceptions that may occur during database operations, preventing the application
from crashing.
Apply 10 Techniques For Exceptional Handling
1. Logging the Exception:
try {
// Look and feel setup code...
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
// Logging the exception at different levels

java.util.logging.Logger.getLogger(Ticket.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);
}

2. Rethrowing the Exception:


try {
// Look and feel setup code...
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
// Rethrowing the exception as a new runtime exception
throw new RuntimeException("Error in setting look and feel", ex);
}
3. Custom Error Handling or User Notification:
try {
// Look and feel setup code...
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
// Custom error handling or user notification
// e.g., JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage(), "Error",
JOptionPane.ERROR_MESSAGE);
}

4. Graceful Error Handling or Recovery Mechanism:


try {
// Look and feel setup code...
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
// Graceful error handling or recovery mechanism
// e.g., Retry setting look and feel with a different method or default option
}

5. Exception Suppression:
try {
// Look and feel setup code...
} catch (ClassNotFoundException ex) {
// Handling ClassNotFoundException
// ...
} catch (InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
// Handling other exceptions and possibly suppressing the original exception
ex.printStackTrace(); // Suppressing the exception
}
6. Use of Finally Block:
try {
// Look and feel setup code...
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
// Exception handling
} finally {
// Code that always executes whether an exception occurred or not
// e.g., cleanup or resource release
}

7.Specific Exception Handling with Different Actions:


try {
// Look and feel setup code...
} catch (ClassNotFoundException ex) {
// Handling ClassNotFoundException
// ...
} catch (InstantiationException ex) {
// Handling InstantiationException differently
// ...
} catch (IllegalAccessException ex) {
// Handling IllegalAccessException differently
// ...
} catch (UnsupportedLookAndFeelException ex) {
// Handling UnsupportedLookAndFeelException differently
// ...
}

8. Nested Try-Catch Blocks:


try {
// Look and feel setup code...
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
try {
// Nested try-catch for more specific handling or recovery
// ...
} catch (Exception nestedEx) {
// Handling exceptions within the nested block
}
}
9. Error Reporting and User Feedback:
try {
// Look and feel setup code...
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
// Error reporting to the user
System.err.println("Error: " + ex.getMessage());
}

10. Contingency Planning with Default Behavior:


try {
// Look and feel setup code...
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
// If an exception occurs, use a default look and feel option
// e.g., fall back to a default look and feel
}

2. Protecting your program from Invalid Inputs :


- Input validation is used to ensure that user-provided data is in the expected format and
range and and in this module no input field are used.

3. Error Handling:
- The code displays error messages using `JOptionPane` to inform the user about issues or
incorrect inputs, providing a better user experience and in this module No error handling are
used.

4.Assertions:
- No assertions are used in my module.
ENHANCING SOFTWARE MAINTENANCE FOR BANK
CUSTOMER PRELIMINARY PROBLEM REPORTING

Team Members:
PAVAN V – 21MIS0044
KAUSHIK K – 21MIS0332
KISHORE S – 21MIS0280
SOMASEKHAR – 21MIS0220
NARESH R – 21MIS0354
INTRODUCTION
▪ In the world of banking, software plays a critical
role in ensuring smooth operations, customer
satisfaction, and financial security. One of the
fundamental aspects of maintaining a robust
banking software system is addressing and
resolving customer-reported problems. This case
study examines a bank's software maintenance
process, focusing on customer preliminary
problem reporting. The primary objectives are to
eliminate obvious usage errors, ascertain the
impact of the problem, identify any ready-made
workarounds, gather the required information, and
communicate effectively with the product
organization.
BACKGROUND:
▪ The bank in question operates a modern online banking
platform that serves millions of customers. This platform
includes web and mobile applications, as well as backend
systems for transaction processing and account
management. Customer satisfaction is a top priority for the
bank, and timely resolution of software issues is crucial to
maintaining high service quality.
CHALLENGES
The bank faced several challenges in its software maintenance process:
1. Eliminating Obvious Usage Errors:
Customers often reported problems that were due to their
misunderstanding or incorrect usage of the software. Distinguishing
between genuine issues and user errors was a significant challenge.
2. Ascertaining the Impact of the Problem:
It was challenging to determine the severity and impact of each
reported problem. Some issues were minor inconveniences, while others
could potentially lead to financial loss or security risks.
3. Identifying Ready-Made Workarounds:
In some cases, there were existing workarounds or temporary solutions
that could be communicated to customers to minimize disruption while the
development team worked on a permanent fix. These workarounds were
not always easy to identify.
4. Gathering Required Information:
To effectively address software issues, the bank needed
comprehensive information from customers, including error
messages, device details, and transaction history. Gathering
this information efficiently was a key concern.
5. Communicating with the Product Organization:
Effective communication between the customer support
team and the software development and quality assurance
teams was essential to ensure that problems were addressed
promptly and effectively.
SOLUTIONS:
The bank implemented the following solutions to improve its software
maintenance process:
1. Customer Education:
The bank developed user-friendly resources, including FAQs, video tutorials,
and tooltips, to help customers better understand and use the software correctly.
This reduced the number of reported issues related to user errors.
2. Issue Severity Assessment:
A systematic process was established to categorize and prioritize reported
problems based on their potential impact. This allowed the bank to allocate
resources more efficiently.
3. Workaround Repository:
A database of known workarounds was created and integrated into the customer
support system. Customer service representatives could easily access and share
these solutions with customers when appropriate.
4. Information Gathering Tools:
The bank introduced a dedicated problem reporting tool that
guided customers through the process of providing essential
information. This tool ensured that all necessary details were
collected for each reported problem.
5. Effective Communication:
Cross-functional teams were established to facilitate
communication between customer support, software
development, and quality assurance. Regular meetings and
status updates were implemented to ensure that problems
were addressed promptly and that customers received timely
updates on their reported issues.
RESULTS:
The implementation of these solutions led to significant
improvements in the software maintenance process. The bank
experienced a decrease in the number of issues related to
user errors, more accurate problem severity assessments,
faster issue resolution times, and increased customer
satisfaction. By optimizing the preliminary problem reporting
process, the bank was better equipped to deliver a reliable
and secure online banking experience.
CONCLUSION:
▪ Enhancing the software maintenance process for
preliminary problem reporting in a bank is crucial for
maintaining customer satisfaction and the overall integrity of
the banking software. By addressing challenges related to
usage errors, problem severity assessment, workarounds,
information gathering, and communication, the bank was
able to improve its software maintenance efficiency and,
ultimately, provide a better banking experience
for its customers.

You might also like