Dsa Team 4 Project
Dsa Team 4 Project
Submitted by
B.S.SANATH [RA2211042020020]
R.S.VISHNU KUMAR [RA2211042020021]
SANJAY.A.N [RA2211042020022]
SRIRAM.D [RA2211042020023]
RAMA KRISHNAN.S.G [RA2211042020024]
MUTHU VISHAL [RA2211042020025]
BACHELOR OF TECHNOLOGY
in
RAMAPURAM , CHENNAI-600089
OCTOBER 2023
1
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
BONAFIDE CERTIFICATE
Certified that the Mini Project titled “Shopping cart” is the Bonafide
certificate of Team Member's (RA2211042020020- B.S.SANATH,
RA2211042020021- R.S.VISHNU KUMAR, RA2211042020022
SANJAY A,N, RA2211042020023- SRIRAM D, RA2211042020024
RAMA KRISHNAN SG, RA2211042020025-MUTHU VISHAL) of II
Year CSE/Specialization submitted for the course 21CSC201J Data
Structures and Algorithms for the Academic Year 2023 – 24 Odd
Semester.
SIGNATURE
Dr. G. Gangadevi
Assistant Professor
Computer Science & Engineering
SRM Institute of Science and Technology
Ramapuram, Chennai.
2
AIM:
The aim of the shopping cart program is to create a robust and user-friendly system allows
customers to shop for products, add items to their cart, and complete the purchase process
with ease.
SCOPE:
The scope of the shopping cart program encompasses the core features and functionalities
it will provide:
Product Management: Managing a list of products with details like name, price, and
availability.
Cart Management: Allowing users to add, remove, and update items in their shopping cart.
Checkout Process: Guiding users through the payment and order confirmation steps.
Cross-Device Linking: Enabling users to access their carts and orders from multiple
devices.
Objectives:
Streamlined Shopping: Enable users to browse, search for, and add items to their cart with
ease.
3
User Account Management: Allow users to create accounts, manage their profile, and
view order history.
Persistence: Save and retrieve cart data for registered users across devices.
Problem Statement:
The problem statement identifies the challenge the shopping cart program aims to address,
such as providing a convenient and secure platform for online shopping and order
management.
Problem Description:
The problem description delves deeper into the issues the program aims to solve. This
includes addressing concerns like cart management, user authentication, and cross-device
access for online shoppers.
Performance:
Performance considerations involve optimizing the system for speed and efficiency. This
includes minimizing load times, handling concurrent users, and efficiently processing
orders.
Cross-Device Linking:
Implementing cross-device linking requires a user account system with the ability to log in
from different devices and access the same cart and order history. It may involve user
account synchronization and secure access management.
4
5
CODE:
#include<stdio.h>
#include<string.h>
main()
{
static int totalCost;
int i,j,choice,c=1,a[9],cost[9];
for(i=0;i<9;i++)
a[i]=0;
char str[100];
char items[9][100]={"Sandisk 16 GB",
"Logitech Mouse",
"Pendrve 16 GB",
"Adidas",
"Nike",
"Leecooper",
"Mi Note 3",
"Nokia 3",
"Samsung"
};
printf("Please Enter Your Name\n");
gets(str);
printf("Hello %s, Welcome to our Online Shopping.\n",str);
do{
//C is 1 by default
if(c==1){
printf("Enter\n1 - Computer Accessories\n2 - Shoes\n3 - Mobiles\nAny other number to exit\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
{
int accessoriesChoice;
printf("Enter\n1 - Sandisk 16 GB - Rs.355\n2 - Logitech Mouse- Rs.500\n3 - Pendrive 16 GB -
Rs.550\nAny other number to exit\n");
scanf("%d",&accessoriesChoice);
cost[0]=355;
cost[1]=500;
cost[2]=550;
switch(accessoriesChoice)
{
case 1:
{
int num;
printf("You chose Sandisk 16GB with Rs.355.Are you sure to buy.If 'Yes' Enter 1 else any
number\n");
scanf("%d",&num);
if(num==1)
{
a[0]++;
totalCost+=355;
}
6
printf("Your Cost in Cart is %d\n",totalCost);
break;
}
case 2:
{
int num;
printf("You chose Logitech Mouse with Rs.500.Are you sure to buy.If 'Yes' Enter 1 else any
number\n");
scanf("%d",&num);
if(num==1)
{
a[1]++;
totalCost+=500;
}
printf("Your Cost in Cart is %d\n",totalCost);
break;
}
case 3:
{
int num;
printf("You chose Pendrive 16GB with Rs.550.Are you sure to buy.If 'Yes' Enter 1 else any
number\n");
scanf("%d",&num);
if(num==1)
{
a[2]++;
totalCost+=550;
}
printf("Your Cost in Cart is %d\n",totalCost);
break;
}
default:{
printf("Exit from Computer Accesories\n");
break;
}
}
break;
}
case 2:
{
int shoesChoice;
printf("Enter\n1 - Adidas - Rs.3550\n2 - Nike - Rs.5000\n3 - Leecooper - Rs.2800\nAny other
number to exit\n");
scanf("%d",&shoesChoice);
cost[3]=3550;
cost[4]=5000;
cost[5]=2800;
switch(shoesChoice)
{
case 1:
{
int num;
printf("You chose Adidas Shoes for Rs.3550.Are you sure to buy.If 'Yes' Enter 1 else any
number\n");
7
scanf("%d",&num);
if(num==1)
{
a[3]++;
totalCost+=3550;
}
printf("Your Cost in Cart is %d\n",totalCost);
break;
}
case 2:
{
int num;
printf("You chose Nike Shoes for Rs.5000.Are you sure to buy.If 'Yes' Enter 1 else any
number\n");
scanf("%d",&num);
if(num==1)
{
a[4]++;
totalCost+=5000;
}
printf("Your Cost in Cart is %d\n",totalCost);
break;
}
case 3:
{
int num;
printf("You chose Leecooper Shoes for Rs.2800.Are you sure to buy.If 'Yes' Enter 1 else any
number\n");
scanf("%d",&num);
if(num==1)
{
a[5]++;
totalCost+=2800;
}
printf("Your Cost in Cart is %d\n",totalCost);
break;
}
default:{
printf("Exit from Shoes Category\n");
break;
}
}
break;
}
case 3:
{
int mobileChoice;
printf("Enter\n1 - Mi Note 3 - Rs.11000\n2 - Nokia 3 - Rs.9866\n3 - Samsung - Rs.12800\nAny
other number to exit\n");
scanf("%d",&mobileChoice);
cost[6]=11000;
cost[7]=9866;
cost[8]=12800;
switch(mobileChoice)
8
{
case 1:
{
int num;
printf("You chose to buy Mi Note 3 for Rs.11000.Are you sure to buy.If 'Yes' Enter 1 else any
number\n");
scanf("%d",&num);
if(num==1)
{
a[6]++;
totalCost+=11000;
}
printf("Your Cost in Cart is %d\n",totalCost);
break;
}
case 2:
{
int num;
printf("You chose to buy Nokia 3 for Rs.9866.Are you sure to buy.If 'Yes' Enter 1 else any
number\n");
scanf("%d",&num);
if(num==1)
{
a[7]++;
totalCost+=9866;
}
printf("Your Cost in Cart is %d\n",totalCost);
break;
}
case 3:
{
int num;
printf("You chose to buy Samsung for Rs.12800.Are you sure to buy.If 'Yes' Enter 1 else any
number\n");
scanf("%d",&num);
if(num==1)
{
a[8]++;
totalCost+=12800;
}
printf("Your Cost in Cart is %d\n",totalCost);
break;
}
default:{
printf("Exit from Mobile Category\n");
break;
}
}
break;
}
default:
{
printf("Enter Valid Categories Choice\n");
break;
9
}
}
printf("%s's cart\n",str);
printf("Id\tItems\t\t\tQuantity\t\t\tCost\n");
for(i=0;i<9;i++)
{
if(a[i]!=0)
{
printf("%d\t%s\t\t%d\t\t\t%d\n",i,items[i],a[i],(cost[i]*a[i]));
}
}
printf("Total Cost\t\t\t\t\t%d\n",totalCost);
printf("If you wish to buy anything more Enter\n1 to Add Item\n2 to Delete Items \nAny other
number to Exit\n");
scanf("%d",&c);
}
if(c==2)
{
int id;
printf("Enter id to delete item\n");
scanf("%d",&id);
if(id<9&&id>0){
totalCost=totalCost-(cost[id]*a[id]);
a[id]=0;
}
else{
printf("Enter Valid id\n");
}
printf("Revised Items \n");
printf("Id\tItems\t\t\tQuantity\t\tCost\n");
for(i=0;i<9;i++)
{
if(a[i]!=0)
{
printf("%d\t%s\t\t%d\t\t%d\n",i,items[i],a[i],(cost[i]*a[i]));
}
}
printf("Total Cost\t\t\t\t\t%d\n",totalCost);
printf("If you wish to buy anything more Enter\n1 to Add Item\n2 to Delete Items \nAny other
number to Exit\n");
scanf("%d",&c);
}
}while(c==1 || c==2);
printf("Your Final Cost is %d\n",totalCost);
printf("Thanks %s for Choosing Us and Visit us again.\n",str);
SCREENSHOTS:
10
RESULT :
In conclusion the shopping cart application is a functional c program that efficiently allows users to
shop from products form their favorite stores with a help of a carefully structured algorithm. The
code contains essential components like calculating total cost and displaying items in the cart in a
tabular column. This application helps enrich users to communicate better with online stores and
maximizing the potential of ecommerce businesses.it demonstrates the programs capability to
handle exchange of goods which can be extended or incorporated into larger software systems if
needed.
11