[go: up one dir, main page]

0% found this document useful (0 votes)
34 views17 pages

Oops Practical

The document describes developing an online supermarket system using C++. It discusses how the system will automate the shopping process and allow users to pay online. It then provides details on the objectives of the system, including providing a secure login and saving users time and money. It outlines the main modules as the administrator and users. It also discusses the technologies used like C++ and its features. Finally, it provides an example code for the supermarket system class.

Uploaded by

Harsh Baraliya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views17 pages

Oops Practical

The document describes developing an online supermarket system using C++. It discusses how the system will automate the shopping process and allow users to pay online. It then provides details on the objectives of the system, including providing a secure login and saving users time and money. It outlines the main modules as the administrator and users. It also discusses the technologies used like C++ and its features. Finally, it provides an example code for the supermarket system class.

Uploaded by

Harsh Baraliya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Super Market In C++

CHAPTER 1

1. INTRODUCTION

The main objective of the project is to develop online Super Market


system. User have to visit shop to Buy products. In shop it is also difficult to
find products. In this Super Market system we will automate all the shopping
process. In our Super Market system user can pay money online easily. The
most common type of personal delivery involves storing grocery inventory
in a warehouse to deliver to customers once orders are placed. The main
purpose of developing Super Market system is to design an application,
which could store shop data and provide an interface for retrieving customer
related details with 100% accuracy.

An online grocer is either a brick-and-mortar supermarket or grocery


store that allows online ordering, or a standalone e-commerce service that
includes grocery items.[1][2] There is usually a delivery charge for this service.
Brick-and-mortar supermarkets that have built internet channels to better
service their clients are known as online grocers.[3] Online grocery delivery
services are available throughout Europe, Asia and North America, mostly in
urban centers. The online ordering is done through e-commerce websites or
mobile apps.

The COVID-19 pandemic greatly accelerated the growth of online


grocers, and in the first few months of the pandemics online grocery
shopping increased by 300%.[4] In addition, first-time online grocery
shoppers accounted for 41% of online grocery shoppers. [5] The epidemic of
COVID-19 has hastened the uptake of online grocery shopping. Pre-
COVID-19 food shopping activity accounted for 9% of the market, but 63
percent of consumers worldwide purchased more groceries online after the
outbreak than they did before they were socially isolated.[6]

The objective of Super Market system are:-

The main object of this system is to provide a secure system. Our


system is password protected and it only allows authorized user to access
various functions available in the system.

 Save time and money.


 Enjoy a convenient shopping experience.
 Reduce temptation for impulse buying unhealthy items.

STC/SPRT/CW/2022 Page 1
Super Market In C++

 Stay on budget by searching for lowest-price items, using electronic coupons


and knowing the running total before checkout.
 Plan meals ahead of time and avoid buying items that are already on hand.
 Know what products are in stock and choose substitutions when needed.
 Add items to your virtual cart throughout the week, as a modern-day
shopping list.
 Choose how to receive the items, such as through free store pickup or an at-
home delivery service.

STC/SPRT/CW/2022 Page 2
Super Market In C++

CHAPTER 2
SUPER MARKET SYSTEM

This system can be implemented to any shop in the locality or to multinational branded
shops having retail outlet chains. The system recommends a facility to accept the orders
24*7 and a home delivery system which can make customers happy. If shops are providing
an online portal where their customers can enjoy easy shopping from anywhere, the shops
won’t be losing any more customers to the trending online shops such as flipcart or ebay.
Since the application is available in the Smartphone it is easily accessible and always
available.

Study of System :-

The system after careful analysis has been identified to be presented with the
following modules and roles.The modules involved are:

 Administrator
 Users

Administrator :

The administrator is the super user of this application. Only Admin have access into this
admin page. Admin may be the owner of the shop. The administrator has all the
information about all the users and about all products.

Most importantly, they ensure a safe and efficient user experience. This may include
implementing security protocols, modifying programs, creating backups, resolving
software problems, updating content.

STC/SPRT/CW/2022 Page 3
Super Market In C++

Mange Products:

Fig 1.1: Manages products

 Add product:

The shopping cart project contains different kind of products. The products
can be classified into different categories by name. Admin can add new
products into the existing system with all its details.

 Delete product:

Administrator can delete the products based on the stock of that particular
product.

 View product:

Admin will have a list view of all the existing products. He can also search
for a particular product by name.

STC/SPRT/CW/2022 Page 4
Super Market In C++

CHAPTER 3
TECHNOLOGY USED

 What is C++?

C++ is a general-purpose, object-oriented programming language. It was


created by Bjarne Stroustrup at Bell Labs circa 1980. C++ is very similar to C
(invented by Dennis Ritchie in the early 1970s). C++ is so compatible with C that it
will probably compile over 99% of C programs without changing a line of source
code. Though C++ is a lot of well-structured and safer language than C as it OOPs
based.

Some computer languages are written for a specific purpose. Like, Java was initially
devised to control toasters and some other electronics. C was developed for
programming OS. Pascal was conceptualized to teach proper programming
techniques. But C++ is a general-purpose language. It well deserves the widely
acknowledged nickname “Swiss Pocket Knife of Languages.”

 Characteristics

C++ is a superset of the C programming language. C itself is a descendant of


several generations of early languages; it was created and implemented with
conflicting goals in mind. This is why C++ contains features that are inconsistent
and sometimes irritating. In this section, I will briefly review the major
characteristics of C and then will show how C++ uses this "inheritance" to achieve
its goals.

 Features of C++

C++ is an upgraded version of C programming. The main idea behind creating C++
programming was to add object orientation to the C programming language. The
major upgradations are object-oriented programming methodology, namespace
feature, operator overloading, error & exception handling. The motivation behind
object-oriented programming is to try to see the whole world in the form of classes
& objects. 

There are various features of C++ such as,

STC/SPRT/CW/2022 Page 5
Super Market In C++

o Object Oriented
o Simple
o Platform Dependent
o Mid-level programming language
o Structured programming language
o Rich Library
o Memory Management
o Powerful & Fast 
o Pointers
o Compiler based
o Syntax based language

 Application C++ Programming Language :

Almost all the programs and systems that you use or a part of their codebase is
written either in C or C++. Be it Windows, a web browser, your favorite game, or a
video editing software, the uses of C++ can be found in almost all applications
today. Here are some interesting areas where C++ is popularly used.

o Operating system : C++ is a fast and strongly-typed programming language


which makes it an ideal choice for developing operating systems. Mac OS X
has large amounts written in C++. Most of the software from Microsoft like
Windows, Microsoft Office, IDE Visual Studio, and Internet Explorer are
also written in C++.

o Games : Since C++ is closer to hardware, game development companies use


it as their primary choice to develop gaming systems. It can easily
manipulate resources and can override the complexities of 3D games and
multiplayer networking.

o GUI Based Applications : C++ is also used to develop GUI-based and


desktop applications. Most of the applications from Adobe such as
Photoshop, Illustrator, etc. are developed using C++.

o Web Browsers : Web browsers need to be fast in execution as people do not


like to wait for their web pages to be loaded. This is why most browsers are
developed in C++ for rendering purposes. Mozilla Firefox is completely
developed from C++. Google applications like Chrome and Google File
System are partly written in C++.

STC/SPRT/CW/2022 Page 6
Super Market In C++

CHAPTER 4
CODE OF SUPER MARKET

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <iostream>
#include <fstream>
#include <iterator>
#include <memory>
#include <ostream>
#include <string>

using namespace std;

class shopping
{
private:
int pcode;
float price;
float dis;
string pname;
public:
void menu();
void administrator();
void add();
void buyer();
void edit();
void remov();
void list();
void receipt();

};

void shopping ::menu()


{
m:
int choice;
string email;
string password;

cout << "\t\t\t _____________________________ \n";


cout << "\t\t\t| Super Market Mian Menu |\n";
cout << "\t\t\t|_____________________________|\n";
cout << "\t\t\t|_____________________________|\n";

cout << "\t\t\t | 1.Administrator|\n";


cout << endl;

STC/SPRT/CW/2022 Page 7
Super Market In C++

cout << "\t\t\t | 2.Buyer |\n";


cout << endl;
cout << "\t\t\t | 3.Exit |\n";
cout << "\t\t\t ____________________________ \n";
cout << "\t\t\t| |\n";
cout << "\t\t\t ---------------------------- \n";
cout << "Please Select!\n>";
cin >> choice;

switch (choice)
{
case 1:
cout << "Please Login \n";

cout << "Email : ";


cin >>email;

cout << endl << "Password : ";


cin >> password;

if (email=="khizar.shah01@gmail.com" &&
password=="rootroot") {
administrator();
}

else {

cout << "\t\t\tInvalid Email/Password";


cout << endl;
cout << endl;
goto m;
}

/* if (email!="khizar.shah01@gmail.com") {
cout << "Invalid Email" << endl;
}
if (password!="rootroot") {
cout << "Invalid Password" << endl;
}*/
case 2:
{
buyer();
}

case 3:
{
exit(0);
}
default:
{
cout << "Select valid option";
}
}

STC/SPRT/CW/2022 Page 8
Super Market In C++

goto m;

void shopping::administrator()
{
m:
int choice;

cout << "\n\n\t\t\t Administrator Menu";


cout << endl;
cout << "\n\n\t\t\t 1) Add the product.";
cout << endl;
cout << "\n\n\t\t\t 2) Modify the product.";
cout << endl;
cout << "\n\n\t\t\t 3) Delete the product.";
cout << endl;
cout << "\n\n\t\t\t 4) Back to Mian Menu.";

cout <<"\n Please Select!\n>";


cin >> choice;

switch (choice) {
case 1:
add();
break;
case 2:
edit();
break;
case 3:
remov();
break;
case 4:
menu();
break;
default:
cout << "Select right option";
}
goto m;
}

void shopping::buyer()
{
m:
int choice;

cout << "\n\n\n\t\t\t Buyer\n";


cout << "\t\t____________________________________\n";
cout << "\t\t\t1) Buy products \n";
cout << "\t\t\t2) Go Back\n\n";
cout << "\t\t\tPlease Select!\n>";
cin >> choice;

STC/SPRT/CW/2022 Page 9
Super Market In C++

switch (choice) {
case 1:
receipt();
break;
case 2:
menu();
break;
default:
cout << "\n Invalid option";
goto m;
}

void shopping::add()
{
m:
fstream data;
int c;
int token=0;
float p;
float d;
string n;

cout << "\n\t Add Product \n";


cout << "\n Product id \n>";
cin >> pcode;
cout << "\n Product name \n>";
cin >> pname;
cout << "\n Product price \n>";
cin >> price;
cout << "\n Product discount \n>";
cin >> dis;

data.open("database.txt",ios::in);

if(!data)
{
data.open("database.txt",ios::app|ios::out);
data<<" "<<pcode<<" "<<pname<<" "<<price<<" "<<dis<<"\n";
data.close();
}
else
{
data>>c>>n>>p>>d;

while (!data.eof())
{
if(c ==pcode)
{
token++;
}
data>>c>>n>>p>>d;

STC/SPRT/CW/2022 Page 10
Super Market In C++

}
data.close();

if(token==1)
goto m;
else
{
data.open("database.txt",ios::app|ios::out);
data<<" "<<pcode<<" "<<pname<<" "<<price<<" "<<dis<<"\n";
data.close();
}
}
cout << "\n\n\t Record inserted!";
}

void shopping ::edit()


{
fstream data,data1;
int pkey;
int token=0;
int c;
float p;
float d;
string n;

cout << "\n\t Modify Record\n";


cout << "\n\t Product code\n";
cin >> pkey;

data.open("database.txt",ios::in);
if(!data)
{
cout<<"\n\t File doesn't exit \n";
}
else {
data1.open("database1.txt",ios::app|ios::out);
data>>pcode>>pname>>price>>dis;
while(!data.eof())
{
if(pkey==pcode)
{
cout <<"\n\tProduct new code :";
cin >>c;
cout <<"\n\tName of the product :";
cin >>n;
cout <<"\n\tPrice :";
cin >>p;
cout <<"\n\tDiscount :";
cin >>d;

data1<<" "<<c<<" "<<n<<" "<<p<<" "<<d<<"\n";


cout<<"\n\t Record edited !";
token++;

STC/SPRT/CW/2022 Page 11
Super Market In C++

}
else {
data1<<" "<<pcode<<" "<<pname<<" "<<price<<"
"<<dis<<"\n";
}
data>>pcode>>price>>pname>>dis;
}
data.close();
data1.close();

remove("database.txt");
rename("database1.txt","database.txt");

if (token==0) {
cout << "\n\t Record not found !";
}
}
}

void shopping::remov()
{
fstream data,data1;
int pkey;
int token=0;
cout <<"\n\tDlete product";
cout <<"\n\tProduct code :";
cin >> pkey;
data.open("database.txt",ios::in);
if(!data){
cout << "\n File doesnt exit !";
}
else {
data1.open("database1.txt",ios::app|ios::out);
data>>pcode>>pname>>price>>dis;

while (!data.eof()) {
if (pcode==pkey) {
cout <<"\n\tProduct Delete succesfully";
token++;
}
else{
data1<<" "<<pcode<<" "<<pname<<" "<<price<<" "<<dis<<"\
n";
}
data>>pcode>>pname>>price>>dis;
}
data.close();
data1.close();
remove("database.txt");
rename("database1.txt","database.txt");

if(token==0)

STC/SPRT/CW/2022 Page 12
Super Market In C++

{
cout <<"\n\t Record not found!";
}
}

void shopping:: list()


{
fstream data;
data.open("database.txt",ios::in);
cout <<"\n\n---------------------------------\n";
cout <<"PrNo\t\t Name\t\t Price\n";
cout <<"\n\n---------------------------------\n";
data >>pcode>>pname>>price>>dis;
while (!data.eof()) {
cout <<pcode<<"\t\t"<<pname<<"\t\t"<<price<<"\n";
data >>pcode>>pname>>price>>dis;
}
data.close();
}

void shopping::receipt()
{

fstream data;
int arrc[100];
int arrq[100];
char choice;
int c=0;
float amount=0;
float dic=0;
float total=0;

cout << "\n\n\n\t Recipt";


data.open("database.txt",ios::in);
if(!data)
{
cout << "\n\n\n Empty data";
}
else{
data.close();

list();
cout <<"\n-------------------------------\n";
cout <<"\n Please place the order \n";
cout <<"\n-------------------------------\n";

do {
m:
cout <<"\t Enter product code :";
cin >> arrc[c];

STC/SPRT/CW/2022 Page 13
Super Market In C++

cout <<"\t Enter quantity :";


cin >> arrq[c];

for (int i=0; i<c; i++)


{
if(arrc[c]==arrc[i])
{
cout <<"\n\n Duplicate product code please try
again";
goto m;
}
}
c++;
cout <<"\n\n Do you want buy another product ? if yes
then press y else no \n>";
cin >>choice;
}
while (choice == 'y');
cout << "\n\n\n\t_______Recipet_______";
cout << "\n Product no\tProduct Name\t Product Price\t
Amount\t Amount with disscount\n ";

for (int i=0; i<c; i++)


{
data.open("database.txt",ios::in);
data >>pcode>>pname>>price>>dis;
while (!data.eof())
{
if (pcode==arrc[i])
{
amount=price*arrq[i];
dis=amount-(amount*dis/100);
total=total+dis;
cout <<"\n"<<" "<<pcode<<" \t"<<
pname<<"\t\t "<<price<<"\t\t "<< amount<<"\t\t"<<dis;
}
data>>pcode>>pname>>price>>dis;
}

}
data.close();
}
cout <<"\n\t\t______________";
cout <<"\n Total amount :"<<total;

int main()
{
shopping s;
s.menu();
return 0;

STC/SPRT/CW/2022 Page 14
Super Market In C++

CHAPTER 5
SCREENSHOT OF PROGRAM

Home interface

Administrator

STC/SPRT/CW/2022 Page 15
Super Market In C++

Buyer Interface

STC/SPRT/CW/2022 Page 16
Super Market In C++

REFERENCES

1. https://www.geeksforgeeks.org/
2. https://www.javatpoint.com/
3. https://www.wikipedia.org/

STC/SPRT/CW/2022 Page 17

You might also like