Sample Mini Project - Ds-Odd Sem 2019
Sample Mini Project - Ds-Odd Sem 2019
PROJECT REPORT
Submitted by
DHIVYA.S
Register No: AAAAAA
OCTOBER 2019
CERTIFICAT
E
Certified that this project report titled “ONLINE SHOPPING CART” is the
bonafide work of Ms. S.DHIVYA who carried out the project under my
supervision. Certified further, that to the best of my knowledge the work reported
I understand the policy on plagiarism and declare that the project and publications
are my own work, except where specifically acknowledged and has not been
copied from other sources or been previously submitted for award or assessment.
XXXXXXXXX XXXXXXXX
Examiner I Examiner
Online Shopping Cart Page |1
ABSTRACT
This is a small scale project for Online Women shopping system. The basic idea is
that customers can by products using online. The administrator can enter the name
and" password" and can create an account and then generate the receipt of the
products purchased. The Online Women Shopping system enables vendors to set
up online shops, customers to browse through the shops' and a system
administrator to approve and reject requests for new shops and maintain lists of
shop categories. Also on the agenda is designing an online shopping site to manage
the items in the shop and also help customers purchase them online without having
to visit the shop physically. Our online shopping mall will use the internet as the
sole method for selling goods to its consumers. Shopping will be highly
personalized and the mall will provide lower prices than most competitors. It is an
online store that enables website owners to sell their product online. It is a web
shopping cart that we! Enables the day-day sales functions. It includes product and
customer management modules. This website will be useful to anyone who wants
to purchase items using internet
Online Shopping Cart Page |2
TABLE OF CONTENTS
LIST OF FIGURES
LIST OF TABLES
LIST OF ABBREVIATIONS
1 PROBLEM DEFINITION
2 REQUIREMENTS SPECIFICATION
4 ALGORITHM DESIGN
3.1 ALGORITHM
5 SOURCE CODE
7 CONCLUSION
8 BIBLIOGRAPHY
Online Shopping Cart Page |2
LIST OF FIGURES
2 Fig 7.1:Output 1 26
Online Shopping Cart Page |2
LIST OF TABLES
LIST OF ABBRIVATIONS
1 PROBLEM DEFINITION
In this software we can add products in cart remove it and if we need we can view the last
added product. The cart also provides the cost of each product as well as total cost of product in
cart.
Online Shopping Cart Page |2
2 REQUIREMENT SPECIFICATION
RAM : 128 MB
Language : C ++
Stacks
Applications
The simplest application of a stack is to reverse a word. You push a given word to stack -
letter by letter - and then pop letters from the stack.
Another application is an "undo" mechanism in text editors; this operation is
accomplished by keeping all text changes in a stack.
Language processing:
o space for parameters and local variables is created internally using a stack.
Online Shopping Cart Page |2
4 ALGORITHM DESIGN
Online Shopping Cart Page |2
4.1 ALGORITHM
Insert()
remove()
check if list is NULL
if yes print no cart to remove
assign p=list;
assign list=list->next;
print all details in cart
display()
assign p=list;
check if p is NULL
if yes print no cart to display
initialize loop
print all product details in cart
currentTotal()
check if list is NULL
if yes print no cart to remove
initialize loop
calculate cost of product
print the details of product with cost
print total cost of cart
5 SOURCE CODE
#include<iostream>
Online Shopping Cart Page |2
#include<string>
#include<cstdlib>
#include<cstdio>
#include<getopt.h>
#include<cstring>
#include<map>
cout << "ele" << elements_in_cart << " " << capacity <<"\n";
if (elements_in_cart == capacity)
{
printf("cart is full\n");
return;
}
do
{
display_category();
//cout << "\n enter the product code\n";
cin >> cat;
//cout << "\n enter the product cost\n";
display_products_in_category(cat);
cin >> pcode;
} while(!is_product_exists(cat, pcode));
return;
}
p=list;
list=list->next;
cout << "\n removed product from the cart is:" << "product code: " << p->product_code << "
product name: " << p->product_name << " product cost: "<< p->product_cost << "\n";
}
void cart :: display()
{
product p;
p=list;
if(p==NULL)
cout << "\n There are no products in the cart to display\n";
for (p=list;p!=NULL;p=p->next)
{
cout << "product code: " << p->product_code << " product name: " << p->product_name <<"
product cost: "<< p->product_cost << "\n";
}
}
for (p=list;p!=NULL;p=p->next)
{
total_cost+=p->product_cost;
cout << "product code: " << p->product_code << " product name: " <<p->product_name <<"
product cost: "<< p->product_cost << "\n";
}
cout << "Current total cost :" << total_cost << "\n";
}
if(itr != p_category.end())
{
#ifdef DEBUG
std::cout << "product category is already added, "
<< "category code => " << pdtls.product_cat_code
<< " category name => " << pdtls.product_category
<< " proceeding to add sub items"
<< endl;
#endif
if(mitr == p_menu.end())
{
std::cout << " item is addd to p_category but can not find in p_menu size => " << p_menu.size()
<< endl;
return false;
}
mitr->second.insert(std::pair<int, std::string>(pdtls.product_code,
std::string(pdtls.product_name)));
#ifdef DEBUG
std::cout << "added sub menu item to the existing category, p_menu size => " << p_menu.size()
<< endl;
#endif
}
else
Online Shopping Cart Page |2
{
p_category.insert(std::pair<int, std::string> (pdtls.product_cat_code,
std::string(pdtls.product_category)));
std::map<int, std::string> ps_menu;
ps_menu.clear();
ps_menu.insert(std::pair<int, std::string>(pdtls.product_code, std::string(pdtls.product_name)));
p_menu.insert(std::pair<int, std::map<int, std::string> >(pdtls.product_cat_code, ps_menu));
#ifdef DEBUG
std::cout << "item added to p_menu and now the size is => " << p_menu.size() << endl;
#endif
}
return true;
}
void display_category()
{
std::map<int, std::string>::iterator itr = p_category.begin();
std::cout << " Choose the category from the below list " << endl;
for(; itr != p_category.end(); ++itr)
{
std::cout << itr->first << " => " << itr->second << endl;
}
std::cout << endl;
}
std::cout << "Select the product from the below menu " << endl;
std::map<int, std::string>::iterator sitr = itr->second.begin();
for(; sitr != itr->second.end(); ++sitr)
{
std::cout << sitr->first << " => " << sitr->second << endl;
}
std::cout << endl;
return true;
}
Online Shopping Cart Page |2
#endif
pdtls.product_cat_code = atoi(value.c_str());
break;
case 1:
memset(pdtls.product_category, '\0', PRODUCT_NAME_LEN);
strcpy(pdtls.product_category, value.c_str());
#ifdef DEBUG
cout << "category name => " << value << endl;
#endif
break;
case 2:
pdtls.product_code = atoi(value.c_str());
#ifdef DEBUG
cout << "product code => " << value << endl;
#endif
break;
case 3:
memset(pdtls.product_name, '\0', PRODUCT_NAME_LEN);
strcpy(pdtls.product_name, value.c_str());
#ifdef DEBUG
cout << "product name=> " << value << endl;
#endif
case 4:
value = trim(line.substr(sindex));
pdtls.product_cost = atoi(value.c_str());
#ifdef DEBUG
cout << "product price Rs. => " << value << endl << endl;
#endif
break;
Online Shopping Cart Page |2
default:
cout << "got more than expected number of delimiters. Ignoring additional values " << endl;
continue;
}
++n;
if(n == MAX_DELIMITER_PER_LINE)
{
std::pair<std::map<int, ProductDetails>::iterator, bool> ret;
int pkey = get_product_key(pdtls.product_cat_code, pdtls.product_code);
ret = stock_details.insert(std::pair<int, ProductDetails>(pkey, pdtls));
if(ret.second == false)
{
std::cout << "product key : " << pkey
<< " already exists. please, check the product details files with unique entries " << endl;
fclose(fptr);
return false;
}
insert_menu_item(pdtls);
}
found = line.find_first_of(":", sindex);
}
memset(buf, '\0', MAX_CHARS_PER_LINE);
}
return true;
}
void display_product_details()
{
std::map<int, ProductDetails>::iterator itr = stock_details.begin();
{
//extern char *optarg;
//extern int optind;
cart c1;
int choice,n,option;
string product_file;
if(argc < 2)
{
cout << "Invalid usage. Please check the usage below" << endl;
print_usage(argv[0]);
exit(EXIT_FAILURE);
}
if(!status)
{
cout << "Failed to load stock details from the file. Please check the file :"
<< product_file << endl;
Online Shopping Cart Page |2
exit(EXIT_FAILURE);
}
#ifdef DEBUG
display_product_details();
#endif
Description:
As we add the items to the cart the price of the items are calculated and displayed.
Online Shopping Cart P a g e | 18
7 CONCLUSION
Our project is a humble venture to satisfy the need of customer who do the online
shopping.. Several user friendly coding have also adopted. This package shall prove to be a
powerful package in satisfying all the requirements of the customer as well as organization.
The objective of software planning is to provide a frame work that enables the
manger to make reasonable estimates made within a limited time frame at the beginning of the
software project and should be updated regularly as the project progresses.
Online Shopping Cart P a g e | 18
8 BIBLIOGRAPHY
1) http://www.tutorialspoint.com/cplusplus/
4) http://scanftree.com/Data_Structure/