0% found this document useful (0 votes)
5 views

Vai Project Edited 3 Fin

Uploaded by

mufeedamanahmed
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)
5 views

Vai Project Edited 3 Fin

Uploaded by

mufeedamanahmed
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/ 21

KR MART

Premier Online Marketplace


INDEX

Sl. No. Contents Page No.

1 Acknowledgement 1

2 Introduction 2

3 User Manual 3

4 Hardware and Software 4


Requirements

5 Source Code 5

6 Output 11

7 Limitations 18

8 Bibliography 19
Acknowledgement

I am glad to present my Computer Science project. This project was


given to us by our respected Computer Science teacher Mr Suman
Lasrado. I am really thankful to him for giving us such a wonderful
opportunity.

I also want to thank our Principal, Sr Melissa and all the staff at
Mount Carmel Central School, for providing me with the required
facilities.

I am grateful to my parents and friends who helped in finishing this


project within the given time.

1
Introduction

Welcome to KR MART, your premier online marketplace, redefining


the way you buy and sell goods. In the bustling aisles of KR MART,
our Python-powered platform seamlessly connects buyers with a
diverse array of products across Electronics, Clothing, Books, Home
Appliances, and Sports categories.

Embrace the refined simplicity of our console-based interface, which


is specifically designed for effortless navigation and interaction. In this
dynamic marketplace, the power lies in your hands whether you're a
seller looking to list your products or a buyer seeking the next great
find.

The backbone of our operation is a robust MySQL backend, ensuring


efficient data management and a smooth user experience. Embark on
a digital shopping journey with KR MART, where every click opens a
gateway to discovery. Uncover treasures, list your offerings, and
experience the convenience of online commerce like never before.

KR MART – Elevating your online shopping experience.

2
User Manual

The application prompts the user for inputs,

1. Exploring Categories
2. Selling Items
3. Buying Items
4. Exiting KR MART

1. Exploring Categories:
• Display Items by Category:
• To view items available in different categories, select option "1."
• Explore diverse categories like Electronics, Clothing, Books,
Home Appliances, and Sports.

2. Selling Items:
• Sell Item:
• To list an item for sale, choose option "2."
• Enter the item's name, price, and select the relevant category.

3. Buying Items:
• Display Items and Buy:
• To view and purchase items, select option "3."
• Enter the number of the category to display items, then follow the
prompts to buy the desired item.

4. Exiting KR MART:
• Quit:
• To exit KR MART, choose option "4."
• Thank you for using KR MART! Your digital shopping destination
awaits.

3
Hardware and Software Requirements

Hardware: Desktop / Laptop


Front End: IDLE (Python 3.10 64- bit)
Back End: My SQL Command Line Client
Operating System: Windows, Linux, MAC OS
Storage: 5 GB Free disk space
Ram: 2 GB RAM
Processor: x86 64-bit CPU (Intel / AMD architecture)

4
Source Code

import mysql.connector

# MySQL configuration
db_config = {
'host': 'localhost',
'user': 'root',
'password': '12345',
'database': 'marketplace'
}

# Function to create a MySQL connection


def get_mysql_connection():
return mysql.connector.connect(**db_config)

def display_items_by_category(category_table):
connection = get_mysql_connection()v v
vf
cursor = connection.cursor()
cursor.execute(f"SELECT * FROM {category_table}")
items = cursor.fetchall()
cursor.close()
connection.close()

if not items:
print(f"\nNo items found in the '{category_table}' category.")
else:
print(f"\n{category_table.capitalize()} Items:")
print("ID\tName\t\tPrice (₹)")
print("-" * 40)
for item in items:
print(f"{item[0]}\t{item[1]}\t\t₹{item[2]:,.2f}")

def sell_item(name, price, category_table):


connection = get_mysql_connection()
cursor = connection.cursor()
cursor.execute(f"INSERT INTO {category_table} (name, price) VALUES (%s,
%s)", (name, price))
connection.commit()
cursor.close()
connection.close()

print(f"\nItem '{name}' listed for sale successfully in the


'{category_table}' category.")

5
def buy_item(category_table):
user_choice = int(input("Enter the ID of the item you want to buy: "))
connection = get_mysql_connection()
cursor = connection.cursor()
cursor.execute(f"SELECT * FROM {category_table} WHERE id = %s",
(user_choice,))
item = cursor.fetchone()

if item:
# Deduct user's balance and update product status
cursor.execute(f"DELETE FROM {category_table} WHERE id = %s",
(user_choice,))
connection.commit()
cursor.close()
connection.close()
print(f"\nYou have purchased '{item[1]}' for ₹{item[2]:,.2f}.")
else:
cursor.close()
connection.close()
print("\nProduct not found.")

def main():
while True:
print("\nOptions:")
print("1. Display Items by Category")
print("2. Sell Item")
print("3. Buy Item")
print("4. Exit")

choice = input("Enter the number of your choice: ")

if choice == '1':
display_items_by_category('electronics')
display_items_by_category('clothing')
display_items_by_category('books')
display_items_by_category('home_appliances')
display_items_by_category('sports')
elif choice == '2':
name = input("Enter the name of the item: ")
price = float(input("Enter the price of the item (₹): "))
print("\nCategories:")
print("1. Electronics")
print("2. Clothing")
print("3. Books")
print("4. Home Appliances")
print("5. Sports")
category_choice = int(input("Enter the number of the category for
the item: "))

6
if category_choice == 1:
sell_item(name, price, 'electronics')
elif category_choice == 2:
sell_item(name, price, 'clothing')
elif category_choice == 3:
sell_item(name, price, 'books')
elif category_choice == 4:
sell_item(name, price, 'home_appliances')
elif category_choice == 5:
sell_item(name, price, 'sports')
else:
print("\nInvalid category number. Item not listed.")
elif choice == '3':
print("\nCategories:")
print("1. Electronics")
print("2. Clothing")
print("3. Books")
print("4. Home Appliances")
print("5. Sports")
category_choice = int(input("Enter the number of the category to
display items: "))

if category_choice == 1:
display_items_by_category('electronics')
buy_item('electronics')
elif category_choice == 2:
display_items_by_category('clothing')
buy_item('clothing')
elif category_choice == 3:
display_items_by_category('books')
buy_item('books')
elif category_choice == 4:
display_items_by_category('home_appliances')
buy_item('home_appliances')
elif category_choice == 5:
display_items_by_category('sports')
buy_item('sports')
else:
print("\nInvalid category number. Please try again.")
elif choice == '4':
break
else:
print("\nInvalid choice. Please try again.")

if __name__ == '__main__':
main()

7
8
9
10
Output

11
12
13
14
15
16
17
Limitations

• Limited Interactivity:
The current implementation relies on a console-based interface, limiting
the interactive and visual aspects of the user experience.

• Basic Security Measures:


The project does not implement advanced security measures, such as
user authentication and authorization, which could be essential for a
real-world application.

• Single-User Interaction:
The application is designed for a single user at a time. Implementing
features for multiple users concurrently interacting with the
marketplace could enhance the project.

18
Bibliography

• Computer Science with Python, for class XII – Sumita Arora


• https://github.com/mysql/mysql-server
• https://www.geeksforgeeks.org/python-mysql/?ref=lbp
• https://www.youtube.com/@TechWithTim
• https://www.youtube.com/watch?v=kUBGiABFFHc

19

You might also like