0% found this document useful (0 votes)
11 views30 pages

Supermarket Billing System Project

Project documents

Uploaded by

diptanshu nandi
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)
11 views30 pages

Supermarket Billing System Project

Project documents

Uploaded by

diptanshu nandi
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

CENTRAL MODEL SCHOOL

BARRACKPORE-700120

COMPUTER SCIENCE PROJECT ON


SUPERMARKET BILLING SYSTEM

SUPERMARKET BILLING
SYSTEM

NAME: DEBANJAN PAUL


ROLL NO.:
CLASS: XII(SCIENCE)
SESSION: 2013-14
FACULTY: MRS. SANGITA SUKUL

Page | 1
CERTIFICATE

This is to certify that Mr. Debanjan Paul a bonafide student of


Class XII has successfully completed the Computer Science
project on “Supermarket Billing” in the academic year
2013-2014.

Mrs. Sharmila Rakshit Mrs. Sangita Sukul

(Principal) (Subject teacher) (External examiner)

Page | 2
ACKNOWLEDGEMENT

I am very grateful to AISSCE to have given us the


opportunity to work on this project. I also hereby express my
gratitude to my Principal Mrs. Sharmila Rakshit and my
Computer teacher Mrs. Sangita Sukul for their guidance
throughout my studies. I also thank my parents who supported
me in all my endeavors. I also thank my classmates who have
equally worked hard to make my project a success.

Page | 3
Page | 4
CONTENTS

[Link] TOPIC PAGE NO.


1 Certificate 2
2 Acknowledgement 3
3 Project Description 6
4 Header file description 7
5 Data Dictionary 8
6 Source Code 9
7 Output 25
8 Bibliography 28

Page | 5
PROJECT DESCRITPTION

This project file on supermarket billing consists chiefly of the


source code to create a simple supermarket billing system to
accept, display or modify product details or commodity
details. We create a data file where we input and store all the
records. The functions in the source code work on this data
file accordingly to read, modify or display records.
The project file also contains beforehand the description of
the header files used and a data dictionary for the variables
and functions that are in the source code. These will hopefully
give a better insight into the program.

Page | 6
HEADER FILE DESCRIPTION

[Link] HEADER FILE DESCRIPTION


1 <conio.h> For defining clrscr() function
2 <stdio.h> Defines types and macros needed for
standard I/O package
3 <process.h> Contains declarations and macros used in
working with threads and processes
4 <fstream.h> Manages console I/O operations

Page | 7
DATA DICTIONARY
CLASS “product”

VARIABLE DECSCRIPTION

[Link] ACCESS NAME TYPE DESCRIPTION


1 private pno int to accept product number
2 private name array(char) to accept the product names
3 private price float to accept product price
4 private qty float to accept quantity
5 private dis float to accept discount %
6 private tax float to store amount of tax

FUNCTION DESCRIPTION

SL.N ACCESS NAME RETURN TYPE DESCRIPTION


O
1 public create_product() void to accept details of a
product
2 public show_product() void to display details of a
product
3 public write_product() void to write in file
4 public display_all() void to read all records from
file
5 public display_sp() void to read specific record
from file

Page | 8
6 public modify_product() void to modify a record
7 public delete_product() void to delete a record
8 public menu() void to display all products’
price list
9 public place_order() void to place order and
generating bill for
Products
10 public intro() void introduction function
11 public admin_menu() void administrator menu
function
12 public main() void main function of the
program

SOURCE CODE
//*******************************************************
********

// HEADER FILE USED IN PROJECT

//*******************************************************
*********

#include<conio.h>

#include<stdio.h>

#include<process.h>

#include<fstream.h>

//*******************************************************
********

// CLASS USED IN PROJECT

//*******************************************************
*********

Page | 9
class product

int pno;

char name[50];

float price,qty,tax,dis;

public:

void create_product()

cout<<"\nPlease Enter The Product No. of The Product ";

cin>>pno;

cout<<"\n\nPlease Enter The Name of The Product ";

gets(name);

cout<<"\nPlease Enter The Price of The Product ";

cin>>price;

cout<<"\nPlease Enter The Discount (%) ";

cin>>dis;

void show_product()

cout<<"\nThe Product No. of The Product : "<<pno;

cout<<"\nThe Name of The Product : ";

Page | 10
puts(name);

cout<<"\nThe Price of The Product : "<<price;

cout<<"\nDiscount : "<<dis;

int retpno()

{return pno;}

float retprice()

{return price;}

char* retname()

{return name;}

int retdis()

{return dis;}

}; //class ends here

//*******************************************************
********

// global declaration for stream object, object

//*******************************************************
*********

fstream fp;

product pr;

//*******************************************************

Page | 11
********

// function to write in file

//*******************************************************
*********

void write_product()

[Link]("[Link]",ios::out|ios::app);

pr.create_product();

[Link]((char*)&pr,sizeof(product));

[Link]();

cout<<"\n\nThe Product Has Been Created ";

getch();

//*******************************************************
********

// function to read all records from file

//*******************************************************
*********

void display_all()

clrscr();

cout<<"\n\n\n\t\tDISPLAY ALL RECORD !!!\n\n";

Page | 12
[Link]("[Link]",ios::in);

while([Link]((char*)&pr,sizeof(product)))

pr.show_product();

cout<<"\n\n====================================\n";

getch();

[Link]();

getch();

//*******************************************************
********

// function to read specific record from file

//*******************************************************
*********

void display_sp(int n)

int flag=0;

[Link]("[Link]",ios::in);

while([Link]((char*)&pr,sizeof(product)))

if([Link]()==n)

Page | 13
{

clrscr();

pr.show_product();

flag=1;

[Link]();

if(flag==0)

cout<<"\n\nrecord not exist";

getch();

//*******************************************************
********

// function to modify record of file

//*******************************************************
*********

void modify_product()

int no,found=0;

clrscr();

cout<<"\n\n\tTo Modify ";

cout<<"\n\n\tPlease Enter The Product No. of The Product";

Page | 14
cin>>no;

[Link]("[Link]",ios::in|ios::out);

while([Link]((char*)&pr,sizeof(product)) && found==0)

if([Link]()==no)

pr.show_product();

cout<<"\nPlease Enter The New Details of Product"<<endl;

pr.create_product();

int pos=-1*sizeof(pr);

[Link](pos,ios::cur);

[Link]((char*)&pr,sizeof(product));

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

found=1;

[Link]();

if(found==0)

cout<<"\n\n Record Not Found ";

getch();

Page | 15
//*******************************************************
********

// function to delete record of file

//*******************************************************
*********

void delete_product()

int no;

clrscr();

cout<<"\n\n\n\tDelete Record";

cout<<"\n\nPlease Enter The product no. of The Product You Want To


Delete";

cin>>no;

[Link]("[Link]",ios::in|ios::out);

fstream fp2;

[Link]("[Link]",ios::out);

[Link](0,ios::beg);

while([Link]((char*)&pr,sizeof(product)))

if([Link]()!=no)

[Link]((char*)&pr,sizeof(product));

Page | 16
}

[Link]();

[Link]();

remove("[Link]");

rename("[Link]","[Link]");

cout<<"\n\n\tRecord Deleted ..";

getch();

//*******************************************************
********

// function to display all products price list

//*******************************************************
*********

void menu()

clrscr();

[Link]("[Link]",ios::in);

if(!fp)

cout<<"ERROR!!! FILE COULD NOT BE OPEN\n\n\n Go To Admin


Menu to create

Page | 17
File";

cout<<"\n\n\n Program is closing ....";

getch();

exit(0);

cout<<"\n\n\t\tProduct MENU\n\n";

cout<<"==================================================
==\n";

cout<<"[Link].\t\tNAME\t\tPRICE\n";

cout<<"==================================================
==\n";

while([Link]((char*)&pr,sizeof(product)))

cout<<[Link]()<<"\t\t"<<[Link]()<<"\t\t"<<[Link]()<<end
l;

[Link]();

//*******************************************************
********

// function to place order and generating bill for Products

//*******************************************************
Page | 18
*********

void place_order()

int order_arr[50],quan[50],c=0;

float amt,damt,total=0;

char ch='Y';

menu();

cout<<"\n============================";

cout<<"\n PLACE YOUR ORDER";

cout<<"\n============================\n";

do{

cout<<"\n\nEnter The Product No. Of The Product : ";

cin>>order_arr[c];

cout<<"\nQuantity in number : ";

cin>>quan[c];

c++;

cout<<"\nDo You Want To Order Another Product ? (y/n)";

cin>>ch;

}while(ch=='y' ||ch=='Y');

cout<<"\n\nThank You For Placing The Order";getch();clrscr();

cout<<"\n

Page | 19
\n********************************INVOICE****************
********\n";

cout<<"\nPr No.\tPr Name\tQuantity \tPrice \tAmount \tAmount


after

discount\n";

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

[Link]("[Link]",ios::in);

[Link]((char*)&pr,sizeof(product));

while(![Link]())

if([Link]()==order_arr[x])

amt=[Link]()*quan[x];

damt=amt-(amt*[Link]()/100);

cout<<"\n"<<order_arr[x]<<"\t"<<[Link]()

<<"\t"<<quan[x]<<"\t\t"<<[Link]()<<"\t"<<amt<<"\t\t"<<damt;

total+=damt;

[Link]((char*)&pr,sizeof(product));

[Link]();

Page | 20
}

cout<<"\n\n\t\t\t\t\tTOTAL = "<<total;

getch();

//*******************************************************
********

// INTRODUCTION FUNCTION

//*******************************************************
*********

void intro()

clrscr();

gotoxy(31,11);

cout<<"SUPER MARKET";

gotoxy(35,14);

cout<<"BILLING";

gotoxy(35,17);

cout<<"PROJECT";

cout<<"\nMADE BY : DEBANJAN PAUL";

cout<<"\nSCHOOL : CENTRAL MODEL SCHOOL";

getch();

Page | 21
//*******************************************************
********

// ADMINSTRATOR MENU FUNCTION

//*******************************************************
*********

void admin_menu()

clrscr();

char ch2;

cout<<"\n\n\n\tADMIN MENU";

cout<<"\n\n\[Link] PRODUCT";

cout<<"\n\n\[Link] ALL PRODUCTS";

cout<<"\n\n\[Link] ";

cout<<"\n\n\[Link] PRODUCT";

cout<<"\n\n\[Link] PRODUCT";

cout<<"\n\n\[Link] PRODUCT MENU";

cout<<"\n\n\[Link] TO MAIN MENU";

cout<<"\n\n\tPlease Enter Your Choice (1-7) ";

ch2=getche();

switch(ch2)

Page | 22
case '1': clrscr();

write_product();

break;

case '2': display_all();break;

case '3':

int num;

clrscr();

cout<<"\n\n\tPlease Enter The Product No. ";

cin>>num;

display_sp(num);

break;

case '4': modify_product();break;

case '5': delete_product();break;

case '6': menu();

getch();

case '7': break;

default:cout<<"\a";admin_menu();

//*******************************************************
********

Page | 23
// THE MAIN FUNCTION OF PROGRAM

//*******************************************************
*********

void main()

char ch;

intro();

do

clrscr();

cout<<"\n\n\n\tMAIN MENU";

cout<<"\n\n\t01. CUSTOMER";

cout<<"\n\n\t02. ADMINISTRATOR";

cout<<"\n\n\t03. EXIT";

cout<<"\n\n\tPlease Select Your Option (1-3) ";

ch=getche();

switch(ch)

case '1': clrscr();

place_order();

getch();

Page | 24
break;

case '2': admin_menu();

break;

case '3':exit(0);

default :cout<<"\a";

}while(ch!='3');

//*******************************************************
********

// END OF PROJECT

Page | 25
OUTPUT

Page | 26
Page | 27
Page | 28
BIBLIOGRAPHY

Books referred to:

1. Computer Science with C++ by Sumita Arora


2. Computer Guide by “Together With”

Websites visited:

1. [Link]
2. [Link]

Page | 29
Page | 30

Common questions

Powered by AI

The 'intro()' function serves as a welcoming interface, giving users an initial overview of the project by displaying the project name and author information. This function enhances user experience by making the software more personable and professional, setting a formal and informative tone before the user interacts with the system's functionalities. Such an introduction can also serve as a checkpoint for ensuring the application is loading correctly .

The 'admin_menu' function serves as the central management interface, linking various administrative tasks necessary for system upkeep, such as creating, displaying, modifying, and deleting products. It integrates different functionalities by offering a menu-driven selection process, facilitating seamless transitions between tasks with minimal user navigation. This function consolidates control mechanisms, thereby streamlining data management and ensuring operational cohesion .

Direct file manipulation in this system simplifies data handling by providing straightforward read and write operations, ensuring immediate updates to records. This approach benefits from reduced complexity compared to more structured databases, enhancing development speed. However, it poses risks such as data loss or corruption from simultaneous access, difficulty in implementing advanced queries or transactions, and lack of data integrity checks. These risks necessitate careful handling, especially in concurrent or multi-user environments where access collisions might occur .

The 'modify_product' function is designed to update the details of an existing product in the data file. It begins by prompting the user to enter the product number of the item to be modified. Then, it reads through the file until it finds the corresponding record. Once found, the function displays the current product details, allows the user to enter new details, and writes these back to the file at the same position, effectively updating the record .

The 'display_sp' function is designed to access and display specific product details based on an input product number, whereas 'display_all' iterates over the entire dataset to show all products. This differentiation is crucial for efficiency, allowing targeted access to specific product information needed for inquiries or updates without wading through the entire product list, ultimately enhancing user convenience and system responsiveness .

The 'place_order' function processes orders by allowing a customer to select products by their product numbers, specify quantities, and then calculate the total cost, including discounts. The function cycles through user inputs, storing selected product numbers and quantities in arrays. It then reads the product data from the file to compute the invoice, including prices before and after discount. Implicit assumptions in its implementation include that all entered product numbers are valid, and every read operation finds the corresponding record correctly .

The potential security vulnerabilities in the system include lack of access control measures, making it susceptible to unauthorized modifications or deletions of records, as any user can access and change product data. Additionally, data integrity is at risk without input validation and verification, leading to potential errors or data corruption from erroneous inputs or file manipulations. Moreover, storing data in plain text makes it vulnerable to unauthorized read access, necessitating encryption or hashed safe storage .

The primary purpose of the 'Supermarket Billing System' is to create a simple computerized system for managing product details and generating bills in a supermarket. It involves accepting, displaying, and modifying product or commodity details through functions operating on a data file .

Headers like <conio.h> and <fstream.h> are crucial for the functionality of the Supermarket Billing System. <conio.h> is primarily used for console input/output operations, such as 'clrscr()' for clearing the screen, enhancing the interactivity of the application. Meanwhile, <fstream.h> facilitates the manipulation of file streams, necessary for reading and writing product data in the supermarket's database. Without these headers, core functionalities like file management and user interaction through the console would be compromised, making them essential for the system's operation .

Using a fixed-size array for storing orders in the system can lead to limitations such as insufficient capacity for large orders, causing data overflow. It restricts scalability as the system's ability to handle orders is capped by the predefined array size. Additionally, memory is not dynamically managed, potentially leading to inefficiency if the array size is overly large without being fully utilized, or inflexibility in handling variable order sizes .

You might also like