0% found this document useful (0 votes)
60 views15 pages

OOP Report 2

This document provides details of a C++ program for a supermarket billing system project. The project uses classes and objects to implement a menu-driven billing system. Key features include a product class to store product details in a binary file, and functions for administrators to create, modify, view and delete product records. Customer can purchase products and generate invoices. The program is over 700 lines long and implements modular programming using functions. The aim is to demonstrate program flow control using user-selected menu options and classes.

Uploaded by

Blaise D'silva
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)
60 views15 pages

OOP Report 2

This document provides details of a C++ program for a supermarket billing system project. The project uses classes and objects to implement a menu-driven billing system. Key features include a product class to store product details in a binary file, and functions for administrators to create, modify, view and delete product records. Customer can purchase products and generate invoices. The program is over 700 lines long and implements modular programming using functions. The aim is to demonstrate program flow control using user-selected menu options and classes.

Uploaded by

Blaise D'silva
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/ 15

Supermarket billing system OOP 22316, Sem III

PART-A PLAN
1.0 Brief Introduction
____________________________________________________
Here is a program to generate supermarket billing system using various class and object, function
and various cases in C++ programming language. Objects are self-contained instances of
that class, and you can get them to interact in fun and exciting ways.

2.0 AIM of Micro-Project


____________________________________________________

The main objective of this program is to demonstrate the program flow control by user selected
options from the given menu. The program uses class structure to implement this feature.

1
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

3.0 Action Plan


____________________________________________________
Sr. Details of Activity Planned Planned Name of Responsible Team Members
No Start Finish
Date Date
1 Project selection Shubham Dahatonde

2 Identifying project outcomes Vedika Sankhe, Shubham Dahatonde

3 Identifying resources required Aayan khan, Shubham Dahatonde

4 Algorithm & implementation Shubham Dahatonde, Vedika Sankhe,


Aayan khan
5 Final outcome All group members

6 Documentation Vedika Sankhe, Shubham Dahatonde

7 Seminer and viva-vose Aayan khan, Manish Yadav

8 Final submission of Micro project All group members

4.0 Resources Required


____________________________________________________

Sr. No Name of Resource Specification Qty Remarks

1 Computer 500GB HDD, 1


4 Gb RAM,
AMD processor,
Windows 10 OS
2 Turbo C - 1

2
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

PART-B OUTCOME

1.0 Brief Description


____________________________________________________

This C++ menu driven programs on SUPERMARKET BILLING SYSTEM has product class
with data members like product no, product name, price, qty, tax, discount. Product details is
stored in a binary file. A customer can purchase product and his invoice generated. Administrator
can create, modify, view and delete product record.

Two classes, class amount and class item can be found in this project in which class amount is
inherited from the class item. The project is simple to understand, and the programme has been
presented in an understandable manner.

The programme for this project is long, over 700 lines


The C++ source code of this supermarket billing system project is compiled in turbo C++
compiler.

3
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

2.0 AIM of Micro-Project


____________________________________________________

The main objective of this program is to demonstrate the program flow control by user selected
options from the given menu. The program uses class structure to implement this feature.

2.0 Course Outcomes (CO)


____________________________________________________
1. Develop a simple C program using arithmetic expression
2. Use functions in C programs for modular Programming approach

4
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

4.0 Procedure Followed


____________________________________________________

//***************************************************************
// HEADER FILE USED IN PROJECT
//****************************************************************

#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>

//***************************************************************
// CLASS USED IN PROJECT
//****************************************************************

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 : ";
puts(name);
cout << "\nThe Price of The Product : " << price;
cout << "\nDiscount : " << dis;
}

int retpno()
5
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

{
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;
//***************************************************************
// function to write in file
//****************************************************************

void write_product()
{
fp.open("Shop.dat", ios::out | ios::app);
pr.create_product();
fp.write((char * ) & pr, sizeof(product));
fp.close();
cout << "\n\nThe Product Has Been Created ";
getch();
}
//***************************************************************
// function to read all records from file
//****************************************************************
void display_all()
{
clrscr();
6
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

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


fp.open("Shop.dat", ios:: in );
while (fp.read((char * ) & pr, sizeof(product)))
{
pr.show_product();
cout << "\n\n====================================\n";
getch();
}
fp.close();
getch();
}
//***************************************************************
// function to read specific record from file
//****************************************************************
void display_sp(int n)
{
int flag = 0;
fp.open("Shop.dat", ios:: in );
while (fp.read((char * ) & pr, sizeof(product)))
{
if (pr.retpno() == n)
{
clrscr();
pr.show_product();
flag = 1;
}
}
fp.close();
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";
cin >> no;
fp.open("Shop.dat", ios:: in | ios::out);
while (fp.read((char * ) & pr, sizeof(product)) && found == 0)
{
if (pr.retpno() == no)
7
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

{
pr.show_product();
cout << "\nPlease Enter The New Details of Product" << endl;
pr.create_product();
int pos = -1 * sizeof(pr);
fp.seekp(pos, ios::cur);
fp.write((char * ) & pr, sizeof(product));
cout << "\n\n\t Record Updated";
found = 1;
}
}
fp.close();
if (found == 0)
cout << "\n\n Record Not Found ";
getch();
}
//***************************************************************
// 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;
fp.open("Shop.dat", ios:: in | ios::out);
fstream fp2;
fp2.open("Temp.dat", ios::out);
fp.seekg(0, ios::beg);
while (fp.read((char * ) & pr, sizeof(product)))
{
if (pr.retpno() != no)
{
fp2.write((char * ) & pr, sizeof(product));
}
}
fp2.close();
fp.close();
remove("Shop.dat");
rename("Temp.dat", "Shop.dat");
cout << "\n\n\tRecord Deleted ..";
getch();
}
//***************************************************************
// function to display all products price list
8
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

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

void menu()
{
clrscr();
fp.open("Shop.dat", ios:: in );
if (!fp)
{
cout << "ERROR!!! FILE COULD NOT BE OPEN\n\n\n Go To Admin Menu to create
File ";
cout << "\n\n\n Program is closing ....";
getch();
exit(0);
}

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


cout << "====================================================\n";
cout << "P.NO.\t\tNAME\t\tPRICE\n";
cout << "====================================================\n";

while (fp.read((char * ) & pr, sizeof(product)))


{
cout << pr.retpno() << "\t\t" << pr.retname() << "\t\t" << pr.retprice() << endl;
}
fp.close();
}

//***************************************************************
// function to place order and generating bill for Products
//****************************************************************

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];
9
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

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\n******************************** INVOICE
************************\n";
cout << "\nPr No.\tPr Name\tQuantity \tPrice \tAmount \tAmount after
discount\ n ";
for (int x = 0; x <= c; x++)
{
fp.open("Shop.dat", ios:: in );
fp.read((char * ) & pr, sizeof(product));
while (!fp.eof())
{
if (pr.retpno() == order_arr[x])
{
amt = pr.retprice() * quan[x];
damt = amt - (amt * pr.retdis() / 100);
cout << "\n" << order_arr[x] << "\t" << pr.retname() <<
"\t" << quan[x] << "\t\t" << pr.retprice() << "\t" << amt << "\t\t" << damt;
total += damt;
}
fp.read((char * ) & pr, sizeof(product));
}

fp.close();
}
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);
10
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

cout << "PROJECT";


cout << "\n\nMADE BY : Shinchan Nohara";
cout << "\n\nSCHOOL : Futaba Kindergarten";
getch();

//***************************************************************
// ADMINSTRATOR MENU FUNCTION
//****************************************************************
void admin_menu()
{
clrscr();
char ch2;
cout << "\n\n\n\tADMIN MENU";
cout << "\n\n\t1.CREATE PRODUCT";
cout << "\n\n\t2.DISPLAY ALL PRODUCTS";
cout << "\n\n\t3.QUERY ";
cout << "\n\n\t4.MODIFY PRODUCT";
cout << "\n\n\t5.DELETE PRODUCT";
cout << "\n\n\t6.VIEW PRODUCT MENU";
cout << "\n\n\t7.BACK TO MAIN MENU";
cout << "\n\n\tPlease Enter Your Choice (1-7) ";
ch2 = getche();
switch (ch2)
{
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;
11
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

case '6':
menu();
getch();
case '7':
break;
default:
cout << "\a";
admin_menu();
}
}
//***************************************************************
// 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();
break;
case '2':
admin_menu();
break;
case '3':
exit(0);
default:
cout << "\a";
}
} while (ch != '3');
}

//***************************************************************
// END OF PROJECT
12
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

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

5.0 Resources Used

____________________________________________________

Sr. No Name of Resource Specification Qty Remarks

1 Computer 500GB HDD, 1


4 Gb RAM,
AMD processor,
Windows 7 OS
2 TurboC++ - 1

13
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

6.0 Outputs of Micro-Projects

____________________________________________________
Output:

14
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.
Supermarket billing system OOP 22316, Sem III

7.0 Skill Developed

Thus, we have studied to make program in C++ language using Object Oriented
Programming.

15
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER ENGG.

You might also like