{"id":87752,"date":"2023-06-23T09:00:36","date_gmt":"2023-06-23T03:30:36","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=87752"},"modified":"2026-06-03T15:03:36","modified_gmt":"2026-06-03T09:33:36","slug":"java-supermarket-billing-system","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/","title":{"rendered":"Java SuperMarket Billing System &#8211; The Future of Shopping"},"content":{"rendered":"<p>In this project, we will be creating a SuperMarket Billing System in Java using swing and SQLite as the database for the application. The System will have Admin and Cashier profiles to choose from. The Cashier can Create new orders and add products to them, and the Bill will be displayed while the products are being added. While the Admin can add and delete the Customer as well as Products from the database and can see the list of customers and products in the database.<\/p>\n<h3>About Java SuperMarket Billing System<\/h3>\n<p>The objective of this project is to provide an understanding of how to create a SuperMarket billing system in Java using SQLite as the database. This project will provide the necessary code to implement the system.<\/p>\n<h3>Prerequisites for SuperMarket Billing System using Java<\/h3>\n<p>1. Eclipse IDE<br \/>\n2. Basic knowledge of SQL<br \/>\n3. Knowledge of Java Programming<br \/>\n4.Basic Knowledge of SQLite(Needed to download the driver and add it to the project)<\/p>\n<h3>Download Java SuperMarket Billing System Project<\/h3>\n<p>Please download the source code of Java SuperMarket Billing System Project from the following link: <a href=\"https:\/\/drive.google.com\/file\/d\/1uMQYbIurT83kXLveaZCik7QgP1bXf1r2\/view?usp=drive_link\"><strong>Java SuperMarket Billing System Project Code<\/strong><\/a><\/p>\n<h3>Steps to Create a SuperMarket Billing System Using Java<\/h3>\n<p>Following are the steps for developing the Java SuperMarket Billing System Project:<\/p>\n<h4>Step 1:Create the necessary classes<\/h4>\n<p><strong>LoginWindow.java:<\/strong> This class will provide the login window to the users, which will contain two profiles to choose from The Admin and The Cashier.<\/p>\n<p><strong>The code for the class is<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.techvidvan;\r\n\r\nimport java.awt.EventQueue;\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.SwingConstants;\r\nimport java.awt.Font;\r\nimport java.awt.event.ActionEvent;\r\nimport java.awt.event.ActionListener;\r\nimport javax.swing.JButton;\r\nimport java.awt.Color;\r\nimport java.awt.GridLayout;\r\n\r\npublic class LoginWindow {\r\n\r\n  private JFrame frmLoginWindow;\r\n\r\n  \/**\r\n   * Launch the application.\r\n   *\/\r\n  public static void main(String[] args) {\r\n    EventQueue.invokeLater(new Runnable() {\r\n      public void run() {\r\n        try {\r\n          LoginWindow window = new LoginWindow();\r\n          window.frmLoginWindow.setVisible(true);\r\n        } catch (Exception e) {\r\n          e.printStackTrace();\r\n        }\r\n      }\r\n    });\r\n  }\r\n\r\n  \/**\r\n   * Create the application.\r\n   *\/\r\n  public LoginWindow() {\r\n    DatabaseOperations.dbInit();\r\n    initialize();\r\n  }\r\n\r\n  \/**\r\n   * Initialize the contents of the frame.\r\n   *\/\r\n  private void initialize() {\r\n    frmLoginWindow = new JFrame();\r\n    frmLoginWindow.getContentPane().setBackground(new Color(192, 191, 188));\r\n    frmLoginWindow.setTitle(\"Supermarket billing system by TechVidvan\");\r\n    frmLoginWindow.setBounds(100, 100, 440, 300);\r\n    frmLoginWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n    frmLoginWindow.getContentPane().setLayout(new GridLayout(0, 1, 0, 10));\r\n    \r\n    JLabel lblWelcome = new JLabel(\"SuperMarket Billing System\");\r\n    lblWelcome.setForeground(new Color(0, 0, 0));\r\n    lblWelcome.setFont(new Font(\"Jua\", Font.BOLD, 30));\r\n    lblWelcome.setHorizontalAlignment(SwingConstants.CENTER);\r\n    frmLoginWindow.getContentPane().add(lblWelcome);\r\n    \r\n    JButton btnAdmin = new JButton(\"Admin\");\r\n    btnAdmin.addActionListener(new ActionListener() {\r\n\r\n      @Override\r\n      public void actionPerformed(ActionEvent e) {\r\n        frmLoginWindow.dispose();\r\n        new AdminLogin();\r\n      }\r\n      \r\n    });\r\n    \r\n    JLabel lblInstruction = new JLabel(\"Please Select Login profile:\");\r\n    lblInstruction.setForeground(Color.BLACK);\r\n    frmLoginWindow.getContentPane().add(lblInstruction);\r\n    frmLoginWindow.getContentPane().add(btnAdmin);\r\n    \r\n    JButton btnCashier = new JButton(\"Cashier\");\r\n    btnCashier.addActionListener(new ActionListener() {\r\n      \r\n      @Override\r\n      public void actionPerformed(ActionEvent e) {\r\n        frmLoginWindow.dispose();\r\n        new CashierPanel();\r\n\r\n        \r\n        \r\n      }\r\n    });\r\n    frmLoginWindow.getContentPane().add(btnCashier);\r\n  }\r\n}<\/pre>\n<p><strong>AdminLogin.java: <\/strong>This class will provide the Admin login window for the users<\/p>\n<p><strong> Code:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.techvidvan;\r\n\r\nimport javax.swing.JFrame;\r\nimport java.awt.event.ActionEvent;\r\nimport java.awt.event.ActionListener;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.JOptionPane;\r\nimport javax.swing.JTextField;\r\nimport javax.swing.JPasswordField;\r\nimport javax.swing.JButton;\r\n\r\npublic class AdminLogin  {\r\n\r\n  private JFrame frame;\r\n  private JTextField adminNameField;\r\n  private JPasswordField passwordField;\r\n  private final String  adminName = \"Admin\";\r\n  private final String password = \"1234\";\r\n\r\n  public AdminLogin() {\r\n    initialize();\r\n  }\r\n\r\n  \/**\r\n   * Initialize the contents of the frame.\r\n   *\/\r\n  private void initialize() {\r\n    frame = new JFrame();\r\n    frame.setBounds(100, 100, 450, 300);\r\n    frame.setTitle(\"Admin Login\");\r\n    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n    frame.getContentPane().setLayout(null);\r\n    \r\n    JLabel lblAdmin = new JLabel(\"Admin Name\");\r\n    lblAdmin.setBounds(0, 67, 173, 36);\r\n    frame.getContentPane().add(lblAdmin);\r\n    \r\n    adminNameField = new JTextField();\r\n    adminNameField.setBounds(222, 68, 184, 36);\r\n    frame.getContentPane().add(adminNameField);\r\n    adminNameField.setColumns(10);\r\n    \r\n    JLabel lblPassword = new JLabel(\"Password\");\r\n    lblPassword.setBounds(0, 134, 173, 36);\r\n    frame.getContentPane().add(lblPassword);\r\n    \r\n    passwordField = new JPasswordField();\r\n    passwordField.setBounds(220, 135, 184, 36);\r\n    frame.getContentPane().add(passwordField);\r\n    \r\n    JButton btnLogin = new JButton(\"Login\");\r\n    btnLogin.setBounds(161, 201, 117, 25);\r\n    btnLogin.addActionListener(new ActionListener() {\r\n      \r\n      @Override\r\n      public void actionPerformed(ActionEvent e) {\r\n        if(adminNameField.getText().equals(adminName) &amp;&amp; password.equals(new String(passwordField.getPassword()))) {\t\t\t\t\tframe.dispose();\r\n          AdminPanel ap = new  AdminPanel(); \r\n          \r\n        }else {\r\n          JOptionPane.showMessageDialog(btnLogin, \"Incorrect Username or Password\");;\r\n        }\r\n        \r\n      }\r\n    });\r\n    frame.getContentPane().add(btnLogin);\r\n    frame.setVisible(true);\r\n  }\r\n}<\/pre>\n<p><strong>AdminPanel: <\/strong>This class will provide Admin functionality to the users<\/p>\n<p><strong>Code<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.techvidvan;\r\n\r\nimport java.awt.BorderLayout;\r\nimport java.awt.GridLayout;\r\nimport java.awt.event.ActionEvent;\r\nimport java.awt.event.ActionListener;\r\nimport java.sql.SQLException;\r\nimport javax.swing.JButton;\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.JOptionPane;\r\nimport javax.swing.JPanel;\r\nimport javax.swing.JScrollPane;\r\nimport javax.swing.JTabbedPane;\r\nimport javax.swing.JTable;\r\nimport javax.swing.JTextField;\r\nimport javax.swing.table.DefaultTableModel;\r\n\r\n@SuppressWarnings(\"serial\")\r\npublic class AdminPanel extends JFrame {\r\n  private JTextField customerNameField;\r\n  private JTextField phoneField;\r\n  private JTextField emailField;\r\n  private JTextField addressField;\r\n  private JTable cusotmerTable;\r\n  private JTextField txtCustdeletefield;\r\n  private JTextField productNameField;\r\n  private JTextField priceField;\r\n  private JTable productTable;\r\n  private JTextField deleteProdField;\r\n  \r\n  public AdminPanel() {\r\n    setSize(700,500);\r\n    \r\n    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);\r\n    getContentPane().add(tabbedPane, BorderLayout.CENTER);\r\n    \r\n    JPanel customerPanel = new JPanel();\r\n    tabbedPane.addTab(\"Customers\", null, customerPanel, null);\r\n    customerPanel.setLayout(new GridLayout(0, 2, 0, 0));\r\n    \r\n    JPanel addCustomerPanel = new JPanel();\r\n    customerPanel.add(addCustomerPanel);\r\n    addCustomerPanel.setLayout(null);\r\n    \r\n    JLabel lblName = new JLabel(\"Name:\");\r\n    lblName.setBounds(0, 0, 173, 87);\r\n    addCustomerPanel.add(lblName);\r\n    \r\n    customerNameField = new JTextField();\r\n    customerNameField.setBounds(173, 0, 173, 87);\r\n    addCustomerPanel.add(customerNameField);\r\n    customerNameField.setColumns(10);\r\n    \r\n    JLabel lblPhone = new JLabel(\"Phone:\");\r\n    lblPhone.setBounds(0, 87, 173, 87);\r\n    addCustomerPanel.add(lblPhone);\r\n    \r\n    phoneField = new JTextField();\r\n    phoneField.setBounds(173, 87, 173, 87);\r\n    addCustomerPanel.add(phoneField);\r\n    phoneField.setColumns(10);\r\n    \r\n    JLabel lblEmail = new JLabel(\"Email;\");\r\n    lblEmail.setBounds(0, 174, 173, 87);\r\n    addCustomerPanel.add(lblEmail);\r\n    \r\n    emailField = new JTextField();\r\n    emailField.setBounds(173, 174, 173, 87);\r\n    emailField.setColumns(10);\r\n    addCustomerPanel.add(emailField);\r\n    \r\n    JLabel lblAddress = new JLabel(\"Address:\");\r\n    lblAddress.setBounds(0, 261, 173, 87);\r\n    addCustomerPanel.add(lblAddress);\r\n    \r\n    addressField = new JTextField();\r\n    addressField.setBounds(173, 261, 173, 87);\r\n    addressField.setColumns(10);\r\n    addCustomerPanel.add(addressField);\r\n    \r\n    JButton btnAddCustomer = new JButton(\"Add customer\");\r\n    btnAddCustomer.setBounds(0, 348, 340, 87);\r\n    btnAddCustomer.addActionListener(new ActionListener() {\r\n      public void actionPerformed(ActionEvent e) {\r\n        try {\r\n          DatabaseOperations.addCustomer(customerNameField.getText(), phoneField.getText(), emailField.getText(), addressField.getText());\r\n          JOptionPane.showMessageDialog(btnAddCustomer, \"Added Successfully\");\r\n        } catch (SQLException e1) {\r\n          JOptionPane.showMessageDialog(btnAddCustomer, \"Can't Add customer\");\r\n          e1.printStackTrace();\r\n        }\r\n      }\r\n    });\r\n    addCustomerPanel.add(btnAddCustomer);\r\n    \r\n    JPanel displayPanel = new JPanel();\r\n    customerPanel.add(displayPanel);\r\n    displayPanel.setLayout(null);\r\n    \r\n    JScrollPane scrollPane = new JScrollPane();\r\n    scrollPane.setBounds(0, 36, 347, 400);\r\n    displayPanel.add(scrollPane);\r\n    \r\n    cusotmerTable = new JTable();\r\n    cusotmerTable.setModel(new DefaultTableModel(\r\n      new Object[][] {\r\n        {null, null, null, null, null},\r\n      },\r\n      new String[] {\r\n        \"id\", \"Name\", \"Phone\", \"Email\", \"Address\"\r\n      }\r\n    ) {\r\n      boolean[] columnEditables = new boolean[] {\r\n        false, false, false, true, true\r\n      };\r\n      public boolean isCellEditable(int row, int column) {\r\n        return columnEditables[column];\r\n      }\r\n    });\r\n    cusotmerTable.getColumnModel().getColumn(0).setResizable(false);\r\n    cusotmerTable.getColumnModel().getColumn(1).setResizable(false);\r\n    cusotmerTable.getColumnModel().getColumn(2).setResizable(false);\r\n    scrollPane.setViewportView(cusotmerTable);\r\n    \r\n    txtCustdeletefield = new JTextField();\r\n    txtCustdeletefield.setBounds(0, 0, 125, 36);\r\n    displayPanel.add(txtCustdeletefield);\r\n    txtCustdeletefield.setColumns(10);\r\n    \r\n    JButton btnDeletecust = new JButton(\"Delete\");\r\n    btnDeletecust.addActionListener(new ActionListener() {\r\n      public void actionPerformed(ActionEvent e) {\r\n        try {\r\n          DatabaseOperations.delete(Integer.valueOf(txtCustdeletefield.getText())  ,\"customers\" );\r\n        } catch (NumberFormatException e1) {\r\n          JOptionPane.showMessageDialog(btnDeletecust, \"Entern numeric value\");\r\n          e1.printStackTrace();\r\n        } catch (SQLException e1) {\r\n          JOptionPane.showMessageDialog(btnDeletecust, \"can't delete\");\r\n          e1.printStackTrace();\r\n        }\r\n      }\r\n    });\r\n    btnDeletecust.setBounds(125, 0, 117, 36);\r\n    displayPanel.add(btnDeletecust);\r\n    \r\n    JButton btnRefereshCust = new JButton(\"Refresh\");\r\n    btnRefereshCust.addActionListener(new ActionListener() {\r\n      public void actionPerformed(ActionEvent e) {\r\n        try {\r\n          DatabaseOperations.loadData((DefaultTableModel)cusotmerTable.getModel(), \"customers\");\r\n        } catch (SQLException e1) {\r\n          \/\/ TODO Auto-generated catch block\r\n          e1.printStackTrace();\r\n        }\r\n      }\r\n    });\r\n    btnRefereshCust.setBounds(240, 0, 100, 36);\r\n    displayPanel.add(btnRefereshCust);\r\n    \r\n    JPanel productsPanel = new JPanel();\r\n    tabbedPane.addTab(\"Products\", null, productsPanel, null);\r\n    productsPanel.setLayout(new GridLayout(0, 2, 0, 0));\r\n    \r\n    JPanel addProductPanel = new JPanel();\r\n    addProductPanel.setLayout(null);\r\n    productsPanel.add(addProductPanel);\r\n    \r\n    JLabel lblName_1 = new JLabel(\"Name:\");\r\n    lblName_1.setBounds(0, 0, 173, 87);\r\n    addProductPanel.add(lblName_1);\r\n    \r\n    productNameField = new JTextField();\r\n    productNameField.setColumns(10);\r\n    productNameField.setBounds(173, 0, 173, 87);\r\n    addProductPanel.add(productNameField);\r\n    \r\n    JLabel lblPrice = new JLabel(\"Price:\");\r\n    lblPrice.setBounds(0, 87, 173, 87);\r\n    addProductPanel.add(lblPrice);\r\n    \r\n    priceField = new JTextField();\r\n    priceField.setColumns(10);\r\n    priceField.setBounds(173, 87, 173, 87);\r\n    addProductPanel.add(priceField);\r\n    \r\n    JButton btnAddProduct = new JButton(\"Add Product\");\r\n    btnAddProduct.addActionListener(new ActionListener() {\r\n      public void actionPerformed(ActionEvent e) {\r\n        try {\r\n          DatabaseOperations.addProduct(productNameField.getText(), Float.valueOf(priceField.getText()));\r\n        } catch (NumberFormatException e1) {\r\n          JOptionPane.showMessageDialog(btnAddProduct, \"Enter decimal values\");\r\n          e1.printStackTrace();\r\n        } catch (SQLException e1) {\r\n          \r\n          e1.printStackTrace();\r\n        }\r\n      }\r\n    });\r\n    btnAddProduct.setBounds(0, 200, 340, 87);\r\n    addProductPanel.add(btnAddProduct);\r\n    \r\n    JButton btnDeleteProduct = new JButton(\"Delete\");\r\n    btnDeleteProduct.addActionListener(new ActionListener() {\r\n      public void actionPerformed(ActionEvent e) {\r\n        try {\r\n          DatabaseOperations.delete(Integer.valueOf(deleteProdField.getText()), \"products\");\r\n        } catch (NumberFormatException e1) {\r\n          JOptionPane.showMessageDialog(btnDeleteProduct, e1.getMessage());\r\n          e1.printStackTrace();\r\n        } catch (SQLException e1) {\r\n          JOptionPane.showMessageDialog(btnDeleteProduct, e1.getMessage());\r\n          e1.printStackTrace();\r\n        }\r\n      }\r\n    });\r\n    btnDeleteProduct.setBounds(230, 399, 117, 30);\r\n    addProductPanel.add(btnDeleteProduct);\r\n    \r\n    deleteProdField = new JTextField();\r\n    deleteProdField.setBounds(100, 399, 114, 30);\r\n    addProductPanel.add(deleteProdField);\r\n    deleteProdField.setColumns(10);\r\n    \r\n    JPanel productsDisplayPanel = new JPanel();\r\n    productsPanel.add(productsDisplayPanel);\r\n    productsDisplayPanel.setLayout(null);\r\n    \r\n    JScrollPane scrollPane_1 = new JScrollPane();\r\n    scrollPane_1.setBounds(0, 36, 347, 400);\r\n    productsDisplayPanel.add(scrollPane_1);\r\n    \r\n    productTable = new JTable();\r\n    productTable.setModel(new DefaultTableModel(\r\n      new Object[][] {\r\n        {null, null, null},\r\n      },\r\n      new String[] {\r\n        \"id\", \"Name\", \"Price\"\r\n      }\r\n    ));\r\n    scrollPane_1.setViewportView(productTable);\r\n    \r\n    JButton btnRefreshProducts = new JButton(\"Refresh\");\r\n    btnRefreshProducts.addActionListener(new ActionListener() {\r\n      public void actionPerformed(ActionEvent e) {\r\n        try {\r\n          DatabaseOperations.loadData((DefaultTableModel)productTable.getModel(), \"products\");\r\n        } catch (SQLException e1) {\r\n          \r\n          e1.printStackTrace();\r\n        }\r\n      }\r\n    });\r\n    btnRefreshProducts.setBounds(0, 0, 117, 30);\r\n    productsDisplayPanel.add(btnRefreshProducts);\r\n    setVisible(true);\r\n  }\r\n}<\/pre>\n<p><strong>CashierPanel.java: <\/strong>This class will provide the Cashier interface to the user<\/p>\n<p><strong> Code<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.techvidvan;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.BoxLayout;\r\nimport javax.swing.JPanel;\r\nimport javax.swing.JScrollPane;\r\nimport javax.swing.JButton;\r\nimport javax.swing.JTable;\r\nimport javax.swing.JComboBox;\r\nimport javax.swing.table.DefaultTableModel;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.JOptionPane;\r\nimport javax.swing.JSpinner;\r\nimport java.awt.event.ActionListener;\r\nimport java.sql.SQLException;\r\nimport java.awt.event.ActionEvent;\r\nimport javax.swing.JTextArea;\r\n\r\n\r\n@SuppressWarnings(\"serial\")\r\npublic class CashierPanel extends JFrame{\r\n  private JTable productsTable;\r\n  private int currentOrderID = 0;\r\n  \r\n  public CashierPanel() {\r\n      setSize(800,600);\r\n      getContentPane().setLayout(null);\r\n      setVisible(true);\r\n      \r\n      JPanel productsPanel = new JPanel();\r\n      productsPanel.setBounds(0, 300, 450, 260);\r\n      getContentPane().add(productsPanel);\r\n      productsPanel.setLayout(null);\r\n      \r\n      JButton btnRefresh = new JButton(\"Refresh\");\r\n      btnRefresh.addActionListener(new ActionListener() {\r\n        public void actionPerformed(ActionEvent e) {\r\n          try {\r\n            DatabaseOperations.loadData((DefaultTableModel)productsTable.getModel(), \"products\");\r\n          } catch (SQLException e1) {\r\n            \/\/ TODO Auto-generated catch block\r\n            e1.printStackTrace();\r\n          }\r\n        }\r\n      });\r\n      btnRefresh.setBounds(350, 10, 100, 30);\r\n      productsPanel.add(btnRefresh);\r\n      \r\n      JScrollPane scrollPane = new JScrollPane();\r\n      scrollPane.setBounds(0, 40, 453, 200);\r\n      productsPanel.add(scrollPane);\r\n      \r\n      productsTable = new JTable();\r\n      productsTable.setModel(new DefaultTableModel(\r\n        new Object[][] {\r\n          {null, null, null},\r\n        },\r\n        new String[] {\r\n          \"Id\", \"Name\", \"Price\"\r\n        }\r\n      ) {\r\n        boolean[] columnEditables = new boolean[] {\r\n          true, true, false\r\n        };\r\n        public boolean isCellEditable(int row, int column) {\r\n          return columnEditables[column];\r\n        }\r\n      });\r\n      scrollPane.setViewportView(productsTable);\r\n      \r\n      JPanel billDisplayPanel = new JPanel();\r\n      billDisplayPanel.setBounds(450, 0, 350, 560);\r\n      getContentPane().add(billDisplayPanel);\r\n      billDisplayPanel.setLayout(new BoxLayout(billDisplayPanel, BoxLayout.X_AXIS));\r\n      \r\n      JScrollPane billScrollpane = new JScrollPane();\r\n      billDisplayPanel.add(billScrollpane);\r\n      \r\n      JTextArea billTextArea = new JTextArea();\r\n      billTextArea.setEditable(false);\r\n      clearBillArea(billTextArea);\r\n      billScrollpane.setViewportView(billTextArea);\r\n      \r\n      JPanel billingPanel = new JPanel();\r\n      billingPanel.setBounds(0, 0, 450, 300);\r\n      getContentPane().add(billingPanel);\r\n      billingPanel.setLayout(null);\r\n      \r\n      JLabel lblSelectCustomer = new JLabel(\"Select Customer:\");\r\n      lblSelectCustomer.setBounds(21, 12, 135, 15);\r\n      billingPanel.add(lblSelectCustomer);\r\n      \r\n      JComboBox&lt;String&gt; customerBox = new JComboBox&lt;String&gt;();\r\n      customerBox.setBounds(177, 7, 200, 30);\r\n      billingPanel.add(customerBox);\r\n      \r\n      JButton btnDiscardOrder = new JButton(\"Discard Order\");\r\n      \r\n      btnDiscardOrder.setEnabled(false);\r\n      btnDiscardOrder.setBounds(50, 75, 300, 25);\r\n      billingPanel.add(btnDiscardOrder);\r\n      \r\n      JLabel lblSelectProducts = new JLabel(\"Select Product:\");\r\n      lblSelectProducts.setBounds(21, 117, 135, 15);\r\n      billingPanel.add(lblSelectProducts);\r\n      \r\n      JComboBox&lt;String&gt; productBox = new JComboBox&lt;String&gt;();\r\n      productBox.setEnabled(false);\r\n      productBox.setBounds(177, 112, 200, 30);\r\n      billingPanel.add(productBox);\r\n      \r\n      JSpinner quantitySpinner = new JSpinner();\r\n      quantitySpinner.setEnabled(false);\r\n      quantitySpinner.setBounds(177, 145, 200, 30);\r\n      billingPanel.add(quantitySpinner);\r\n      \r\n      JLabel lblQuantity = new JLabel(\"Quantity:\");\r\n      lblQuantity.setBounds(21, 152, 135, 15);\r\n      billingPanel.add(lblQuantity);\r\n      \r\n      JButton btnAddToBill = new JButton(\"Add to Bill\");\r\n      btnAddToBill.setEnabled(false);\r\n      btnAddToBill.addActionListener(new ActionListener() {\r\n        public void actionPerformed(ActionEvent e) {\r\n          String prodID = (String)productBox.getSelectedItem();\r\n          prodID = prodID.substring(0, prodID.indexOf('-'));\r\n          String[] product = new String[3];\r\n          try {\r\n             product= DatabaseOperations.getProd(Integer.valueOf(prodID));\r\n              float price = (int)quantitySpinner.getValue()*Float.valueOf(product[2]);\r\n\r\n             DatabaseOperations.addOrderItems(currentOrderID,\r\n                 \t\t\t\t\t\t\tInteger.valueOf(prodID), \r\n                 \t\t\t\t\t\t\t(int)quantitySpinner.getValue(),\r\n                 \t\t\t\t\t\t\tFloat.valueOf(price) );\r\n          } catch (NumberFormatException | SQLException e1) {\r\n            \/\/ TODO Auto-generated catch block\r\n            e1.printStackTrace();\r\n          }\r\n          \r\n          billTextArea.append(\"*\"+product[0]+\"\\t\"+product[1]+\"\\t\"+(int)quantitySpinner.getValue()+\"\\t\"+(int)quantitySpinner.getValue()*Float.valueOf(product[2])+\"\\n\");\r\n        }\r\n      });\r\n      btnAddToBill.setBounds(210, 187, 140, 30);\r\n      billingPanel.add(btnAddToBill);\r\n      \r\n      JButton btnRemoveLast = new JButton(\"Remove Last\");\r\n      btnRemoveLast.addActionListener(new ActionListener() {\r\n        public void actionPerformed(ActionEvent e) {\r\n          try {\r\n            DatabaseOperations.deleteOrderItem(currentOrderID);\r\n          } catch (SQLException e2) {\r\n            \/\/ TODO Auto-generated catch block\r\n            e2.printStackTrace();\r\n          }\r\n          String text = billTextArea.getText();\r\n          try {\r\n            text = text.substring(0, text.lastIndexOf(\"*\"));\r\n          } catch (Exception e1) {\r\n            JOptionPane.showMessageDialog(btnRemoveLast, \"NO Items to remove\");\r\n            e1.printStackTrace();\r\n          }\r\n          billTextArea.setText(text);\r\n        }\r\n      });\r\n      btnRemoveLast.setEnabled(false);\r\n      btnRemoveLast.setBounds(210, 220, 140, 30);\r\n      billingPanel.add(btnRemoveLast);\r\n      \r\n      JButton btnGenerateBill = new JButton(\"Generate Bill\");\r\n      btnGenerateBill.setEnabled(false);\r\n      btnGenerateBill.setBounds(100, 260, 200, 35);\r\n      billingPanel.add(btnGenerateBill);\r\n      \r\n      JButton btnCreateNewOrder = new JButton(\"Create new Order for Customer\");\r\n      btnCreateNewOrder.addActionListener(new ActionListener() {\r\n        public void actionPerformed(ActionEvent e) {\r\n          clearBillArea(billTextArea);\r\n          btnCreateNewOrder.setEnabled(false);\r\n          customerBox.setEnabled(false);\r\n          productBox.setEnabled(true);\r\n          quantitySpinner.setEnabled(true);\r\n          btnAddToBill.setEnabled(true);\r\n          btnRemoveLast.setEnabled(true);\r\n          btnGenerateBill.setEnabled(true);\r\n          btnDiscardOrder.setEnabled(true);\r\n          \r\n          String custID = (String)customerBox.getSelectedItem(); \r\n          try {\r\n            currentOrderID = DatabaseOperations.createNewOrder(Integer.valueOf(custID.substring(0, custID.indexOf('-'))));\r\n          } catch (NumberFormatException e1) {\r\n            \/\/ TODO Auto-generated catch block\r\n            e1.printStackTrace();\r\n          } catch (SQLException e1) {\r\n            \/\/ TODO Auto-generated catch block\r\n            e1.printStackTrace();\r\n          }\r\n          billTextArea.append(\"Customer name :\"+custID.substring(custID.lastIndexOf('-')+1)+\"\\n\");\r\n          billTextArea.append(\"Order ID:\"+currentOrderID+\"\\n\\n\");\r\n          billTextArea.append(\"ProdID\\tName\\tQt\\tRs.\\n\");\r\n        }\r\n      });\r\n      btnCreateNewOrder.setBounds(50, 45, 300, 25);\r\n      billingPanel.add(btnCreateNewOrder);\r\n      \r\n      btnDiscardOrder.addActionListener(new ActionListener() {\r\n        public void actionPerformed(ActionEvent e) {\r\n          btnCreateNewOrder.setEnabled(true);\r\n          customerBox.setEnabled(true);\r\n          \r\n          productBox.setEnabled(false);\r\n          quantitySpinner.setEnabled(false);\r\n          btnAddToBill.setEnabled(false);\r\n          btnRemoveLast.setEnabled(false);\r\n          btnGenerateBill.setEnabled(false);\r\n          btnDiscardOrder.setEnabled(false);\r\n          try {\r\n            DatabaseOperations.discardOrder(currentOrderID);\r\n            clearBillArea(billTextArea);\r\n            currentOrderID =0;\r\n          } catch (SQLException e1) {\r\n            \/\/ TODO Auto-generated catch block\r\n            e1.printStackTrace();\r\n          }\r\n        }\r\n      });\r\n      \r\n      btnGenerateBill.addActionListener(new ActionListener() {\r\n        public void actionPerformed(ActionEvent e) {\r\n          btnCreateNewOrder.setEnabled(true);\r\n          customerBox.setEnabled(true);\r\n          productBox.setEnabled(false);\r\n          quantitySpinner.setEnabled(false);\r\n          btnAddToBill.setEnabled(false);\r\n          btnRemoveLast.setEnabled(false);\r\n          btnGenerateBill.setEnabled(false);\r\n          btnDiscardOrder.setEnabled(false);\r\n          float price =0;\r\n          try {\r\n            price = DatabaseOperations.getTotalPrice(currentOrderID);\r\n          } catch (SQLException e1) {\r\n            \/\/ TODO Auto-generated catch block\r\n            e1.printStackTrace();\r\n          }\r\n          billTextArea.append(\"\\t\\tGrand Total\\t\"+price);\r\n          currentOrderID =0;\r\n        }\r\n      });\r\n      try {\r\n        DatabaseOperations.updateCombox(\"customers\",customerBox);\r\n        DatabaseOperations.updateCombox(\"products\",productBox);\r\n      } catch (SQLException e1) {\r\n        \/\/ TODO Auto-generated catch block\r\n        e1.printStackTrace();\r\n      }\r\n  }\r\n  \r\n\/\/\tMethod to reset the bill text area to the default\r\n  private void clearBillArea(JTextArea area) {\r\n    area.setText(\"\\t-----------Gurukul Supermarket----------\\n\");\r\n  }\r\n  \r\n  \r\n  \r\n\r\n}<\/pre>\n<p><strong>DatabaseOperations.java: <\/strong>This class will provide us with the database operations such as adding and deleting records from the database. This class will be used to manipulate the database.<br \/>\n<strong>Code<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.techvidvan;\r\nimport java.sql.Connection;\r\nimport java.sql.Date;\r\nimport java.sql.PreparedStatement;\r\nimport java.sql.ResultSet;\r\nimport java.sql.SQLException;\r\nimport java.sql.Statement;\r\nimport javax.swing.JComboBox;\r\nimport javax.swing.table.DefaultTableModel;\r\nimport org.sqlite.SQLiteDataSource;\r\n\r\npublic class DatabaseOperations {\r\n\/\/\tdeclaring connection and dataSource variables\r\n  private static Connection conn;\r\n  private static SQLiteDataSource ds;\r\n  \r\n\/\/\tinitialize method to initialize the database with all the tables\r\n  public static void dbInit() {\r\n    ds = new SQLiteDataSource();\r\n    \r\n    try {\r\n            ds = new SQLiteDataSource();\r\n            ds.setUrl(\"jdbc:sqlite:Supermarket.db\");\r\n        } catch ( Exception e ) {\r\n            e.printStackTrace();\r\n            \r\n            System.exit(0);\r\n        }\r\n        try {\r\n        \t conn = ds.getConnection();\r\n        \t \r\n        \t Statement statement = conn.createStatement();\r\n             statement.executeUpdate(\"CREATE TABLE IF NOT EXISTS customers (\\n\"\r\n             \t\t+ \"  id INTEGER PRIMARY KEY,\\n\"\r\n             \t\t+ \"  name TEXT NOT NULL,\\n\"\r\n             \t\t+ \"  phone TEXT NOT NULL,\\n\"\r\n             \t\t+ \"  email TEXT,\\n\"\r\n             \t\t+ \"  address TEXT\\n\"\r\n             \t\t+ \");\\n\"\r\n\r\n             \t\t\r\n             \t\t+ \"CREATE TABLE IF NOT EXISTS products (\\n\"\r\n             \t\t+ \"  id INTEGER PRIMARY KEY,\\n\"\r\n             \t\t+ \"  name TEXT NOT NULL,\\n\"\r\n             \t\t+ \"  price DECIMAL(10,2) NOT NULL\\n\"\r\n             \t\t+ \");\\n\"\r\n             \t\t\r\n             \t\r\n             \t\t+ \"CREATE TABLE IF NOT EXISTS orders (\\n\"\r\n             \t\t+ \"  id INTEGER PRIMARY KEY AUTOINCREMENT,\\n\"\r\n             \t\t+ \"  customer_id INTEGER NOT NULL,\\n\"\r\n             \t\t+ \"  date DATETIME NOT NULL,\\n\"\r\n             \t\t+ \"  FOREIGN KEY (customer_id) REFERENCES customers(id)\\n\"\r\n             \t\t+ \");\\n\"\r\n             \t\t\r\n             \t\t+ \"CREATE TABLE IF NOT EXISTS order_items (\\n\"\r\n             \t\t+ \"  id INTEGER PRIMARY KEY AUTOINCREMENT,\\n\"\r\n             \t\t+ \"  order_id INTEGER NOT NULL,\\n\"\r\n             \t\t+ \"  product_id INTEGER NOT NULL,\\n\"\r\n             \t\t+ \"  quantity INTEGER NOT NULL,\\n\"\r\n             \t\t+ \"  price DECIMAL(10,2) NOT NULL,\\n\"\r\n             \t\t+ \"  FOREIGN KEY (order_id) REFERENCES orders(id),\\n\"\r\n             \t\t+ \"  FOREIGN KEY (product_id) REFERENCES products(id)\\n\"\r\n             \t\t+ \");\\n\"\r\n             \t\t);\r\n             \r\n             \r\n\/\/           Closing statement and connection  \r\n             statement.close();\r\n        \t conn.close();\r\n        \t \r\n        }catch ( SQLException e ) {\r\n            e.printStackTrace();\r\n            System.exit( 0 );\r\n        }\r\n        finally {\r\n            try {\r\n                if (conn != null) {\r\n                    conn.close();\r\n                }\r\n            }catch (SQLException e) {\r\n                System.err.println(e);\r\n              }\r\n        \r\n        }\r\n  \r\n\r\n  }\r\n\r\n    \r\n  \r\n  \r\n\r\n  \/*\r\n   * ----------------------------------- Order Operations--------------------------------------------------\r\n   *\/\r\n\/\/\tMethod to create new orders\r\n  public static int createNewOrder(int custID) throws SQLException {\r\n    conn = ds.getConnection();\r\n    PreparedStatement ps =conn.prepareStatement(\"INSERT INTO \"\r\n                          + \"orders(customer_id,date)\"\r\n                          + \"VALUES(?,?)\");\r\n    \r\n    ps.setInt(1, custID);\r\n    ps.setDate(2, Date.valueOf(java.time.LocalDate.now()));\r\n    ps.executeUpdate();\r\n    ResultSet rs = ps.getGeneratedKeys();\r\n    rs.next();\r\n    int oid = rs.getInt(1);\r\n    rs.close();\r\n    ps.close();\r\n    conn.close();\r\n    return oid;\r\n  }\r\n  \r\n\/\/\tMethod to add new items to the order \r\n  public static void addOrderItems(int orderID,int prodID,int quantity,Float price) throws SQLException {\r\n    conn = ds.getConnection();\r\n    PreparedStatement ps = conn.prepareStatement(\"INSERT INTO order_items (order_id, product_id, quantity, price)\"\r\n        + \" VALUES(?,?,?,?);\");\r\n    ps.setInt(1, orderID);\r\n    ps.setInt(2, prodID);\r\n    ps.setInt(3, quantity);\r\n    ps.setFloat(4, price);\r\n    \r\n    ps.executeUpdate();\r\n    ps.close();\r\n    conn.close();\r\n    \r\n  }\r\n  \r\n\/\/\tMethod to discard\/delete the order and the ordered items\r\n  public static void discardOrder(int orderID) throws SQLException{\r\n    conn = ds.getConnection();\r\n    String sql = \"DELETE  FROM order_items WHERE order_id = ?;\\n\";\r\n    PreparedStatement ps = conn.prepareStatement(sql);\r\n    ps.setInt(1, orderID);\r\n    ps.executeUpdate();\r\n    ps = conn.prepareStatement(\"DELETE  FROM orders WHERE id = ?;\");\r\n    ps.setInt(1, orderID);\r\n    ps.executeUpdate();\r\n    ps.close();\r\n    \r\n    \r\n    conn.close();\r\n  }\r\n\r\n\/\/\tMethod to delete items from the order_items table \r\n  public static void deleteOrderItem(int orderID) throws SQLException {\r\n    conn = ds.getConnection();\r\n    String sql = \"DELETE FROM order_items WHERE id = (SELECT MAX(id) FROM order_items WHERE order_id = ?);\";\r\n    \r\n    PreparedStatement ps = conn.prepareStatement(sql);\r\n    ps.setInt(1, orderID);\r\n    ps.executeUpdate();\r\n    \r\n    ps.close();\r\n    conn.close();\r\n  }\r\n  \r\n\/\/\tMethod to total up the price for the specific order \r\n  public static float getTotalPrice(int orderID) throws SQLException {\r\n    conn = ds.getConnection();\r\n    PreparedStatement ps =conn.prepareStatement(\"SELECT SUM(price) as total_price\\n\"\r\n        + \"FROM order_items WHERE order_id = ?;\");\r\n    \r\n    ps.setInt(1, orderID);\r\n    ResultSet rs = ps.executeQuery();\r\n    float price = rs.getFloat(1);\r\n    ps.close();\r\n    conn.close();\r\n    \r\n    return price;\r\n  }\r\n\r\n  \/*\r\n   * ----------------------------------- Product Operations--------------------------------------------------\r\n   *\/\r\n\r\n\/\/\tmethod to add the produc into the database\r\n  public static void addProduct( String name, Float price) throws SQLException {\r\n        String query = \"INSERT INTO products (name, price) VALUES (?, ?)\";\r\n    conn = ds.getConnection();\r\n        PreparedStatement stmt = conn.prepareStatement(query);\r\n            stmt.setString(1, name);\r\n            stmt.setFloat(2, price);\r\n            \r\n            stmt.executeUpdate();\r\n            stmt.close();\r\n            conn.close();\r\n        \r\n        }\r\n  \r\n  \r\n  \/\/Method to get product details from the database\r\n    public static String[] getProd(int id) throws SQLException {\r\n      \r\n      conn = ds.getConnection();\r\n      PreparedStatement ps =conn.prepareStatement(\"SELECT * FROM products WHERE id = ?\");\r\n      \r\n      ps.setInt(1, id);\r\n      ResultSet rs = ps.executeQuery();\r\n      String[] product = {rs.getString(\"id\"),rs.getString(\"name\"),rs.getString(\"price\")};\r\n      ps.close();\r\n      conn.close();\r\n      \r\n      return product;\r\n    }\r\n  \r\n  \r\n  \/*\r\n   * ----------------------------------- Customer Operations--------------------------------------------------\r\n   *\/\r\n    public static void addCustomer( String name, String phone, String email, String address) throws SQLException {\r\n          String query = \"INSERT INTO customers (name, phone, email, address) VALUES (?, ?, ?, ?)\";\r\n      conn = ds.getConnection();\r\n          PreparedStatement stmt = conn.prepareStatement(query);\r\n              stmt.setString(1, name);\r\n              stmt.setString(2, phone);\r\n              stmt.setString(3, email);\r\n              stmt.setString(4, address);\r\n              \r\n              stmt.executeUpdate();\r\n              stmt.close();\r\n              conn.close();\r\n          \r\n          }\r\n    \r\n    public static void delete(int id,String table) throws SQLException {\r\n      String query = \"DELETE FROM \"+table+\" WHERE id = ? \";\r\n      conn = ds.getConnection();\r\n          PreparedStatement stmt = conn.prepareStatement(query);\r\n              stmt.setInt(1, id);\r\n              stmt.executeUpdate();\r\n              stmt.close();\r\n              conn.close();\r\n    }\r\n    \r\n\r\n  \r\n\/\/\tMethod to update the comboBoxes with data from the database\r\n  public static void updateCombox(String table,JComboBox&lt;String&gt; cbx) throws SQLException {\r\n    cbx.removeAll();\r\n    conn = ds.getConnection();\r\n    String sql = \"SELECT * FROM \"+table+\";\";\r\n    PreparedStatement ps = conn.prepareStatement(sql);\r\n    ResultSet rs = ps.executeQuery();\r\n    \r\n    while(rs.next()) {\r\n      cbx.addItem(rs.getString(\"id\") +\"-|-\"+ rs.getString(\"name\"));\r\n    }\r\n    \r\n    \r\n    rs.close();\r\n    ps.close();\r\n    conn.close();\r\n\r\n  }\r\n\r\n\r\n  \r\n\/\/\tMethod to Load Data from the database into the table\r\n  public static void loadData(DefaultTableModel model,String table) throws SQLException {\r\n    model.setRowCount(0);\r\n    conn = ds.getConnection();\r\n    String sql = \"SELECT * FROM \"+table+\";\";\r\n    PreparedStatement ps = conn.prepareStatement(sql);\r\n    ResultSet rs = ps.executeQuery();\r\n    Object[] row = new Object[model.getColumnCount()]; \r\n    while (rs.next()) {\r\n      for (int i = 0; i &lt; row.length; i++) {\r\n        row[i] = rs.getObject(i+1);\r\n      }\r\n      model.addRow(row);\r\n\r\n    }\r\n    ps.close();\r\n    conn.close();\r\n  }<\/pre>\n<ul>\n<li>The<strong> dbInit()<\/strong> method initializes the database with tables for customers, products, orders, and order_items if they don&#8217;t already exist. The method also creates an SQLiteDataSource object and sets the URL to the database location.<\/li>\n<li>The <strong>createNewOrder()<\/strong> method inserts a new order into the orders table and returns the order ID. The method takes the customer ID as an argument.<\/li>\n<li>The <strong>addOrderItems()<\/strong> method inserts a new order item into the order_items table. The method takes the order ID, product ID, quantity, and price as arguments.<\/li>\n<li>The <strong>discardOrder()<\/strong> method deletes an order and its associated order items from the database. The method takes the order ID as an argument.<\/li>\n<li>The <strong>deleteOrderItem()<\/strong> method deletes the most recently added order item from the database. The method takes the order ID as an argument.<\/li>\n<li>The <strong>getTotalPrice()<\/strong> method returns the total price of all items in a given order. The method takes the order ID as an argument.<\/li>\n<li>The<strong> addProduct()<\/strong> adds the product into the database. It takes two arguments name and price.<\/li>\n<li>The <strong>getProd()<\/strong> method takes id as input and returns an string array containing the information about the product from the database.<\/li>\n<li>The <strong>delete()<\/strong> method deletes the specific item from the given table by taking id and table\u2019s name as parameter.<\/li>\n<\/ul>\n<h3>Java SuperMarket Billing System Output<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/06\/super-market-billing-system-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87935 size-full\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/06\/super-market-billing-system-output.webp\" alt=\"super market billing system output\" width=\"460\" height=\"318\" \/><\/a><\/p>\n<h3><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/06\/java-supermarket-billing-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87936 size-full\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/06\/java-supermarket-billing-output.webp\" alt=\"java supermarket billing output\" width=\"720\" height=\"518\" \/><\/a><\/h3>\n<h3><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/06\/java-supermarket-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87937 size-full\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/06\/java-supermarket-output.webp\" alt=\"java supermarket output\" width=\"820\" height=\"618\" \/><\/a><\/h3>\n<h3><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/06\/supermarket-billing-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87938 size-full\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/06\/supermarket-billing-output.webp\" alt=\"supermarket billing output\" width=\"820\" height=\"618\" \/><\/a><\/h3>\n<h3>Summary<\/h3>\n<p>At the end of the project, we successfully created the Super Market Billing System in Java using Swing and SQLite. We have created a system where the cashier can create new orders and generate bills, and the admin can delete and add Products and New Customers as well. We also learned how we could use SQL to query the database and get the relevant data from the database. However, we can add further information, like using our system to discount a particular bill, add GST and other taxes etc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this project, we will be creating a SuperMarket Billing System in Java using swing and SQLite as the database for the application. The System will have Admin and Cashier profiles to choose from.&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":87934,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[4872,2753,2755,5024,5025,5026,5027],"class_list":["post-87752","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-java-project-for-practice","tag-java-project-ideas","tag-java-projects","tag-java-supermarket-billing-system","tag-java-supermarket-billing-system-project","tag-supermarket-billing-system","tag-supermarket-billing-system-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java SuperMarket Billing System - The Future of Shopping - TechVidvan<\/title>\n<meta name=\"description\" content=\"Revolutionize your supermarket checkout experience with our cutting-edge Java billing system. Fast, user-friendly, and efficient\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java SuperMarket Billing System - The Future of Shopping - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Revolutionize your supermarket checkout experience with our cutting-edge Java billing system. Fast, user-friendly, and efficient\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-23T03:30:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-03T09:33:36+00:00\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java SuperMarket Billing System - The Future of Shopping - TechVidvan","description":"Revolutionize your supermarket checkout experience with our cutting-edge Java billing system. Fast, user-friendly, and efficient","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/","og_locale":"en_US","og_type":"article","og_title":"Java SuperMarket Billing System - The Future of Shopping - TechVidvan","og_description":"Revolutionize your supermarket checkout experience with our cutting-edge Java billing system. Fast, user-friendly, and efficient","og_url":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2023-06-23T03:30:36+00:00","article_modified_time":"2026-06-03T09:33:36+00:00","author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Java SuperMarket Billing System &#8211; The Future of Shopping","datePublished":"2023-06-23T03:30:36+00:00","dateModified":"2026-06-03T09:33:36+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/"},"wordCount":625,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/#primaryimage"},"thumbnailUrl":"","keywords":["java project for practice","java project ideas","java projects","java supermarket billing system","java supermarket billing system project","supermarket billing system","supermarket billing system project"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/","url":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/","name":"Java SuperMarket Billing System - The Future of Shopping - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/#primaryimage"},"thumbnailUrl":"","datePublished":"2023-06-23T03:30:36+00:00","dateModified":"2026-06-03T09:33:36+00:00","description":"Revolutionize your supermarket checkout experience with our cutting-edge Java billing system. Fast, user-friendly, and efficient","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/java-supermarket-billing-system\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Java SuperMarket Billing System &#8211; The Future of Shopping"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/87752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=87752"}],"version-history":[{"count":2,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/87752\/revisions"}],"predecessor-version":[{"id":448026,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/87752\/revisions\/448026"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=87752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=87752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=87752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}