From 8377ed94ce1c5c7c603eb85e48aeb2dee7f2123d Mon Sep 17 00:00:00 2001
From: Bankuru Chandini <22331a4404@mvgrce.edu.in>
Date: Fri, 11 Jul 2025 14:04:33 +0530
Subject: [PATCH 1/5] Add files via upload
---
App.js | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 183 insertions(+)
create mode 100644 App.js
diff --git a/App.js b/App.js
new file mode 100644
index 000000000..7b8998812
--- /dev/null
+++ b/App.js
@@ -0,0 +1,183 @@
+import React, { useEffect, useState } from "react";
+
+function App() {
+ const [products, setProducts] = useState([]);
+ const [searchText, setSearchText] = useState("");
+ const [category, setCategory] = useState("All");
+ const [sortOrder, setSortOrder] = useState("asc");
+
+ // Custom home appliances products to add
+ const customHomeAppliances = [
+ {
+ id: 1001,
+ title: "Air Conditioner",
+ price: 499.99,
+ category: "home appliances",
+ image:
+ "https://cdn-icons-png.flaticon.com/512/684/684908.png",
+ },
+ {
+ id: 1002,
+ title: "Microwave Oven",
+ price: 149.99,
+ category: "home appliances",
+ image:
+ "https://cdn-icons-png.flaticon.com/512/2972/2972185.png",
+ },
+ {
+ id: 1003,
+ title: "Vacuum Cleaner",
+ price: 199.99,
+ category: "home appliances",
+ image:
+ "https://cdn-icons-png.flaticon.com/512/2965/2965567.png",
+ },
+ ];
+
+ useEffect(() => {
+ fetch("https://fakestoreapi.com/products")
+ .then((res) => res.json())
+ .then((data) => {
+ // Combine API data + custom home appliances
+ setProducts([...data, ...customHomeAppliances]);
+ });
+ }, []);
+
+ // Get unique categories + "All"
+ const categories = ["All", ...new Set(products.map((p) => p.category))];
+
+ // Filter and sort products
+ const filteredProducts = products
+ .filter(
+ (product) =>
+ (category === "All" || product.category === category) &&
+ product.title.toLowerCase().includes(searchText.toLowerCase())
+ )
+ .sort((a, b) =>
+ sortOrder === "asc" ? a.price - b.price : b.price - a.price
+ );
+
+ return (
+
+
Welcome to Product Listing
+
+ {/* Controls */}
+
+ setSearchText(e.target.value)}
+ style={{
+ padding: "10px",
+ width: "250px",
+ fontSize: "16px",
+ borderRadius: "5px",
+ border: "1px solid #ccc",
+ }}
+ />
+
+
+
+
+
+
+ {/* Products grid */}
+
+ {filteredProducts.length === 0 ? (
+
No products found.
+ ) : (
+ filteredProducts.map((product) => (
+
+

+
+ {product.title}
+
+
+ {product.category.charAt(0).toUpperCase() + product.category.slice(1)}
+
+
+ ${product.price.toFixed(2)}
+
+
+ ))
+ )}
+
+
+ );
+}
+
+export default App;
From b4f667688619e7953ce4a388e34aafd3a9a08605 Mon Sep 17 00:00:00 2001
From: Bankuru Chandini <22331a4404@mvgrce.edu.in>
Date: Fri, 11 Jul 2025 15:09:45 +0530
Subject: [PATCH 2/5] Add files via upload
---
.../contactbook.java | 79 +++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 NDV_code_by_Chandini_contactbook.java/contactbook.java
diff --git a/NDV_code_by_Chandini_contactbook.java/contactbook.java b/NDV_code_by_Chandini_contactbook.java/contactbook.java
new file mode 100644
index 000000000..c3cbad326
--- /dev/null
+++ b/NDV_code_by_Chandini_contactbook.java/contactbook.java
@@ -0,0 +1,79 @@
+import java.sql.*;
+import java.util.Scanner;
+
+public class ContactBookApp {
+ static final String URL = "jdbc:mysql://localhost:3306/contact_book_db";
+ static final String USER = "root"; // Replace if needed
+ static final String PASS = "your_mysql_password"; // Replace with your MySQL password
+ static Scanner sc = new Scanner(System.in);
+
+ public static void main(String[] args) {
+ int choice;
+ do {
+ System.out.println("\n1. Add Contact\n2. View Contacts\n3. Delete Contact\n0. Exit");
+ System.out.print("Enter choice: ");
+ choice = sc.nextInt(); sc.nextLine();
+ switch (choice) {
+ case 1 -> addContact();
+ case 2 -> viewContacts();
+ case 3 -> deleteContact();
+ case 0 -> System.out.println("Goodbye!");
+ default -> System.out.println("Invalid choice.");
+ }
+ } while (choice != 0);
+ }
+
+ static void addContact() {
+ try (Connection conn = DriverManager.getConnection(URL, USER, PASS)) {
+ System.out.print("Enter Name: ");
+ String name = sc.nextLine();
+ System.out.print("Enter Phone: ");
+ String phone = sc.nextLine();
+ System.out.print("Enter Email: ");
+ String email = sc.nextLine();
+
+ String sql = "INSERT INTO contacts (name, phone, email) VALUES (?, ?, ?)";
+ PreparedStatement ps = conn.prepareStatement(sql);
+ ps.setString(1, name);
+ ps.setString(2, phone);
+ ps.setString(3, email);
+ ps.executeUpdate();
+
+ System.out.println("Contact added!");
+ } catch (Exception e) {
+ System.out.println("Error: " + e);
+ }
+ }
+
+ static void viewContacts() {
+ try (Connection conn = DriverManager.getConnection(URL, USER, PASS)) {
+ String sql = "SELECT * FROM contacts";
+ Statement stmt = conn.createStatement();
+ ResultSet rs = stmt.executeQuery(sql);
+ System.out.println("Contacts:");
+ while (rs.next()) {
+ System.out.println("ID: " + rs.getInt("id") +
+ ", Name: " + rs.getString("name") +
+ ", Phone: " + rs.getString("phone") +
+ ", Email: " + rs.getString("email"));
+ }
+ } catch (Exception e) {
+ System.out.println("Error: " + e);
+ }
+ }
+
+ static void deleteContact() {
+ try (Connection conn = DriverManager.getConnection(URL, USER, PASS)) {
+ System.out.print("Enter Contact ID to delete: ");
+ int id = sc.nextInt(); sc.nextLine();
+ String sql = "DELETE FROM contacts WHERE id = ?";
+ PreparedStatement ps = conn.prepareStatement(sql);
+ ps.setInt(1, id);
+ int rows = ps.executeUpdate();
+ if (rows > 0) System.out.println("Contact deleted!");
+ else System.out.println("Contact not found.");
+ } catch (Exception e) {
+ System.out.println("Error: " + e);
+ }
+ }
+}
From 6ba34daeb52fc40ab85e8d12444b84ee64f6ea63 Mon Sep 17 00:00:00 2001
From: Bankuru Chandini <22331a4404@mvgrce.edu.in>
Date: Fri, 11 Jul 2025 15:37:07 +0530
Subject: [PATCH 3/5] Create README.md
---
README.md | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 README.md
diff --git a/README.md b/README.md
new file mode 100644
index 000000000..a20db318f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+ Contact Book App (Java + MySQL)
+This is a simple console-based Contact Book application developed in Java using JDBC to connect to a MySQL database.
+
+Features:
+Add Contact: Save a new contact with name, phone, and email.
+
+View Contacts: Display all saved contacts from the database.
+
+Delete Contact: Remove a contact by entering its ID.
+
+🔧 Technologies Used:
+Java
+
+JDBC (Java Database Connectivity)
+
+MySQL
From 875808d83a544e7955abbe400ca78b5e4ba0a7d7 Mon Sep 17 00:00:00 2001
From: Bankuru Chandini <22331a4404@mvgrce.edu.in>
Date: Fri, 11 Jul 2025 15:39:59 +0530
Subject: [PATCH 4/5] Add files via upload
---
.../OrderManagement.java | 48 +++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 NDV_Code_by_Chandini_OrderManagement/OrderManagement.java
diff --git a/NDV_Code_by_Chandini_OrderManagement/OrderManagement.java b/NDV_Code_by_Chandini_OrderManagement/OrderManagement.java
new file mode 100644
index 000000000..dbe9df5a7
--- /dev/null
+++ b/NDV_Code_by_Chandini_OrderManagement/OrderManagement.java
@@ -0,0 +1,48 @@
+import org.hibernate.*;
+import org.hibernate.cfg.Configuration;
+
+import jakarta.persistence.*;
+
+@Entity
+class Customer {
+ @Id
+ @GeneratedValue
+ private int id;
+ private String name;
+
+ public Customer() {}
+ public Customer(String name) { this.name = name; }
+
+ public int getId() { return id; }
+ public String getName() { return name; }
+ public void setName(String name) { this.name = name; }
+}
+
+public class SimpleOrderApp {
+ public static void main(String[] args) {
+ // Hibernate config
+ Configuration cfg = new Configuration();
+ cfg.setProperty("hibernate.connection.driver_class", "com.mysql.cj.jdbc.Driver");
+ cfg.setProperty("hibernate.connection.url", "jdbc:mysql://localhost:3306/orderdb");
+ cfg.setProperty("hibernate.connection.username", "root");
+ cfg.setProperty("hibernate.connection.password", "your_password"); // <-- Change this
+ cfg.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
+ cfg.setProperty("hibernate.hbm2ddl.auto", "update");
+ cfg.setProperty("hibernate.show_sql", "true");
+
+ cfg.addAnnotatedClass(Customer.class);
+
+ SessionFactory factory = cfg.buildSessionFactory();
+ Session session = factory.openSession();
+ Transaction tx = session.beginTransaction();
+
+ Customer customer = new Customer("Honey");
+ session.save(customer);
+
+ tx.commit();
+ session.close();
+ factory.close();
+
+ System.out.println("✔ Customer saved to DB!");
+ }
+}
From 6ec23a34e67fbaac453a43ec1e6181377f3f1127 Mon Sep 17 00:00:00 2001
From: Bankuru Chandini <22331a4404@mvgrce.edu.in>
Date: Fri, 11 Jul 2025 16:54:21 +0530
Subject: [PATCH 5/5] NDV_Code_By_ChandiniB_ProductCatalog
---
.../ProductCatalog.java | 86 +++++++++++++++++++
1 file changed, 86 insertions(+)
create mode 100644 NDV_Code_By_ChandiniB_ProductCatalog/ProductCatalog.java
diff --git a/NDV_Code_By_ChandiniB_ProductCatalog/ProductCatalog.java b/NDV_Code_By_ChandiniB_ProductCatalog/ProductCatalog.java
new file mode 100644
index 000000000..73b2d857f
--- /dev/null
+++ b/NDV_Code_By_ChandiniB_ProductCatalog/ProductCatalog.java
@@ -0,0 +1,86 @@
+
+
+
+
+
+ Product Catalog
+
+
+
+
+
+
+
+
+

+
Product 1
+
$19.99
+
+
+

+
Product 2
+
$24.99
+
+
+

+
Product 3
+
$29.99
+
+
+
+
+

+
Product 4
+
$15.99
+
+
+

+
Product 5
+
$12.49
+
+
+

+
Product 6
+
$39.99
+
+
+
+
+

+
Product 7
+
$22.00
+
+
+

+
Product 8
+
$30.00
+
+
+

+
Product 9
+
$9.99
+
+
+
+
+

+
Product 10
+
$49.99
+
+
+

+
Product 11
+
$5.99
+
+
+

+
Product 12
+
$14.99
+
+
+
+
+
+