You are on page 1of 33

Guitar Store Management

System
Version 1.0 (2016-2017)

Computer Science Project


Developed By

Shrehit Goel
Rohan Pandey

Delhi Public School, R.K.Puram


www.dpsrkp.net

Project: <Project Title> Developed By <Students Name> Page:#1/33

Index
Sno
1
2
3
4
5
6

Description
Pageno
Certificate
3
Acknowledgement & References
4
Introduction
5
Source Code
7
Output Screen
32
Hardware & Software
40
requirement

Project: <Project Title> Developed By <Students Name> Page:#2/33

Certificate
This is to certify that Banking Management
System
Computer
Science
project
is
developed by Shrehit Goel, and Rohan
Pandey under my supervision in the
computer lab of Delhi Public School,
R.K.Puram in the session 2015-2016. The
work done by them is original.
Mukesh Kumar
Computer Science Teacher
Date: ____________

Project: <Project Title> Developed By <Students Name> Page:#3/33

Acknowledgement
I would like to express my sincere gratitude to my
computer teacher Mr. Mukesh Kumar for his vital support,
guidance and encouragement without which this project
would not come forth from my side. Who helped me
completing the project by giving ideas,thoughts and
made this project easy and accurate.
I wish to thank my parents for their undivided support
and interest who inspired me and encouraged me to go
my own way, without which I would be unable to
complete my project.

Reference
1.www.google.com/C++ project
2.www.wikepedia.com/c++ projects
3.Classnotes.

Introduction
Project: <Project Title> Developed By <Students Name> Page:#4/33

Project: <Project Title> Developed By <Students Name> Page:#5/33

Source Code
/*
GUITARSTORE DATABSE MANAGEMENT SYSTEM
A project by SHREHIT GOEL and ROHAN PANDEY
Class :- XII-F
Group Number :-14
*/
#include
#include
#include
#include
#include
#include
#include

<iostream.h>
<conio.h>
<fstream.h>
<stdio.h>
<stdlib.h>
<string.h>
<iomanip.h>

class guitar
{
int itemno,sold, stock;
char name[80];
float cp, sp;
public:
guitar()
{
sold=0;
stock=0;
}
float spr()
{ return sp; }
float cpr()
{ return cp; }
int stockr()
{ return stock; }
int soldr()
{ return sold; }
void subtract(int x)
{
stock-=x;
sold=x;
}
int ritemno()
{
return itemno;
}
void input()

Project: <Project Title> Developed By <Students Name> Page:#6/33

{
cout<<"\nItem number?\n";
cin>>itemno;
cout<<"\nGuitar model name?\n";
gets(name);
cout<<"\nCost price per piece?\n";
cin>>cp;
cout<<"\nSelling price per piece?\n";
cin>>sp;
cout<<"\nNumber of items?\n";
cin>>stock;
}
void display()
{
cout<<setw(25)<<"Item number "<<": "<<itemno<<endl;
cout<<setw(25)<<"Item name "<<": "<<name<<endl;
cout<<setw(25)<<"Cost Price per unit "<<": "<<cp<<endl;
cout<<setw(25)<<"Selling Price per unit "<<": "<<sp<<endl;
cout<<setw(25)<<"No. of items in stock "<<": "<<stock<<endl;
}
};
class order
{
int id;
char name[80];
char address[80];
char status[20];
int guitarid;
int qtt;
float price;
public:
order()
{
strcpy(status,"unprocessed");
}
int qttr()
{ return qtt; }
int guitaridr()
{ return guitarid; }
float pricer()
{ return price;}
char* statusr()
{
return status;
}
void process()
{
strcpy(status,"processed");

Project: <Project Title> Developed By <Students Name> Page:#7/33

}
int getid()
{
return id;
}
void input()
{
cout<<"\nOrder Id?\n";
cin>>id;
cout<<"\nCustomer name?\n";
gets(name);
cout<<"\nDelivery address?\n";
gets(address);
cout<<"\nGuitar item number bought?\n";
cin>>guitarid;
cout<<"\nNumber of pieces?\n";
cin>>qtt;
strcpy(status,"unprocessed");
}
void display()
{
cout<<setw(25)<<"Order Id "<<": "<<id<<endl;
cout<<setw(25)<<"Customer name "<<": "<<name<<endl;
cout<<setw(25)<<"Delivery Address "<<": "<<address<<endl;
cout<<setw(25)<<"Guitar (Id) brought "<<": "<<guitarid<<endl;
cout<<setw(25)<<"Price per unit "<<": "<<price<<endl;
cout<<setw(25)<<"No. of pieces "<<": "<<qtt<<endl;
cout<<setw(25)<<"Total"<<": "<<qtt*price<<endl;
}
};
void
void
void
void

Mainmenu();
Inventory();
Orders();
Sales();

void addguitar()
{
clrscr();
fstream fil;
fil.open("guitarinventory.bin", ios::binary|ios::app);
guitar g;
cout<<"\nFill details of the guitar(s) :\n";
int choice;
do
{
g.input();
fil.write((char*)&g, sizeof(g));
cout<<"\nData recorded! Input more? (1=Yes, 2=No)\n";
cin>>choice;

Project: <Project Title> Developed By <Students Name> Page:#8/33

getch();
clrscr();
}
while(choice==1);
clrscr();
fil.close();
}
void search()
{
clrscr();
fstream fil;
fil.open("guitarinventory.bin", ios::binary|ios::in);
guitar g;
cout<<"\nType the item number to be searched : ";
int itemno;
cin>>itemno;
int c=0;
while(fil.read((char*)&g, sizeof(g)))
{
if(g.ritemno()==itemno)
{
g.display();
c++;
}
}
if(c==0)
{
cout<<"\nItem not found!"<<endl;
}
fil.close();
getch();
clrscr();
}
void showstatus()
{
clrscr();
fstream fil;
fil.open("guitarinventory.bin", ios::binary|ios::in);
guitar g;
int counttype=0, countnum=0;
while(fil.read((char*)&g, sizeof(g)))
{
counttype++;
countnum+=g.stockr();
}
cout<<"\nTotal types of guitars in inventory = "<<counttype<<"\nTotal number of
all guitars in inventory = "<<countnum<<endl<<endl<<endl;
getch();

Project: <Project Title> Developed By <Students Name> Page:#9/33

clrscr();
fil.close();
}
void removeguitar()
{
clrscr();
fstream fil1, fil2;
fil1.open("guitarinventory.bin", ios::binary|ios::in|ios::out);
fil2.open("tempinventory.bin", ios::binary|ios::in|ios::out);
int inod;
guitar g;
cout<<"Enter the item number of the guitar to be removed : ";
cin>>inod;
int del=0;
while(fil1.read((char*)&g, sizeof(g)))
{
if(g.ritemno()!=inod)
fil2.write((char*)&g, sizeof(g));
else
del++;
}
if(!del)
cout<<"\nGuitar does not exist in inventory!";
else
cout<<"\nGuitar removed from inventory!";
fil1.close();
fil2.close();
remove("guitarinventory.bin");
rename("tempinventory.bin", "guitarinventory.bin");
getch();
clrscr();
}
void registero()
{
clrscr();
fstream fil;
fil.open("order.bin", ios::binary|ios::app);
order o;
cout<<"\nFill details of the order(s) :\n";
int choice;
do
{
o.input();
fil.write((char*)&o, sizeof(o));
cout<<"\nOrder registered! Input more? (1=Yes, 2=No)\n";
cin>>choice;
getch();
clrscr();

Project: <Project Title> Developed By <Students Name> Page:#10/33

}
while(choice==1);
fil.close();
clrscr();
}
void showpending()
{
clrscr();
fstream fil;
fil.open("order.bin", ios::binary|ios::in);
order o;
int count=0;
while(fil.read((char*)&o, sizeof(o)))
{
if(strcmpi(o.statusr(),"unprocessed")==0)
{
o.display();
cout<<endl<<endl;
count++;
}
}
if(count==0)
cout<<"\nNo orders pending!\n";
fil.close();
getch();
clrscr();
}
void quantityalter(order o)
{
fstream fil;
fil.open("guitarinventory.bin", ios::binary|ios::in|ios::out);
guitar g;
while(fil.read((char*)&g,sizeof(g)))
{
if(g.ritemno()==o.guitaridr())
{
int val=o.qttr();
g.subtract(val);
fil.seekg(fil.tellg()-sizeof(g));
fil.write((char*)&g, sizeof(g));
}
}
fil.close();
}
void processorder()
{

Project: <Project Title> Developed By <Students Name> Page:#11/33

clrscr();
fstream fil1, fil2;
fil1.open("order.bin", ios::binary|ios::in|ios::out);
order o;
int x;
cout<<"Enter the id of the order to be processed - ";
cin>>x;
int found=0;
while(!found && fil1.read((char*)&o, sizeof(o)))
{
if(o.getid()==x)
{
if(strcmpi(o.statusr(),"unprocessed")==0)
{
found=1;
o.process();
fil1.seekg(fil1.tellg()-sizeof(o));
fil1.write((char*)&o, sizeof(o));
cout<<"\nOrder Processed!"<<endl;
quantityalter(o);
}
}
}
fil1.close();
getch();
clrscr();
}
void showprocessed()
{
clrscr();
fstream fil;
fil.open("order.bin", ios::binary|ios::in);
order o;
int count=0;
while(fil.read((char*)&o, sizeof(o)))
{
if(strcmpi(o.statusr(),"processed")==0)
{
o.display();
cout<<endl<<endl;
count++;
}
}
if(count==0)
cout<<"\nNo orders processed yet!\n";
fil.close();
getch();
clrscr();
}

Project: <Project Title> Developed By <Students Name> Page:#12/33

void netrevenue()
{
clrscr();
fstream fil1, fil2;
fil1.open("order.bin", ios::binary|ios::in);
fil2.open("guitarinventory.bin", ios::binary|ios::in);
float rev=0;
order o;
guitar g;
while(fil1.read((char*)&o, sizeof(o)))
{
if(strcmpi(o.statusr(),"processed")==0)
{
while(fil2.read((char*)&g, sizeof(g)))
{
if(g.ritemno()==o.guitaridr())
rev+=(o.qttr()*g.spr());
}
}
}
cout<<"\nNet sales revenue till date is "<<rev<<endl;
fil1.close();
fil2.close();
getch();
clrscr();
}
void profit()
{
clrscr();
fstream fil1, fil2;
fil1.open("order.bin", ios::binary|ios::in);
fil2.open("guitarinventory.bin", ios::binary|ios::in);
order o;
guitar g;
float profit=0;
while(fil1.read((char*)&o, sizeof(o)))
{
if(strcmpi(o.statusr(),"processed")==0)
{
while(fil2.read((char*)&g, sizeof(g)))
{
if(g.ritemno()==o.guitaridr())
profit+=o.qttr()*(g.spr()-g.cpr());
}
}
}
cout<<"\nNet sales profit till date is "<<profit<<endl;
fil1.close();

Project: <Project Title> Developed By <Students Name> Page:#13/33

fil2.close();
getch();
clrscr();
}
void main()
{
randomize();
int x,y;
x=random(10);
y=random(10);
while(
x!=y)
{
textcolor(x);
textbackground(y);
x=random(10);
y=random(10);
}
clrscr();
gotoxy(25,5);
cout<<"WELCOME TO THE GUITARSTORE DATABASE!\n";
gotoxy(25,6);
fstream fil;
fil.open("password.txt", ios::binary|ios::in|ios::out);
struct p
{
char a[4];
};
p pw;
cout<<"Type the 4 digit password : ";
char pass[4];
for(int i=0; i<4; i++)
{
pass[i]=getch();
cout<<"*";
}
fil.read((char*)&pw, sizeof(pw));
int count=0;
for(int j=0; j<4; j++)
if(pass[j]!=pw.a[j])
count++;
if(count==0)
Mainmenu();
else
{ clrscr(); gotoxy(27,5); cout<<"WRONG PASSWORD!!!"; }
fil.close();
getch();
}

Project: <Project Title> Developed By <Students Name> Page:#14/33

void Deletedata()
{
clrscr();
cout<<"Are you sure? (1=Yes/2=No)\n";
int n;
cin>>n;
if(n==1)
{
remove("guitarinventory.bin");
remove("order.bin");
remove("sales.bin");
}
else
Mainmenu();
}
void Changepword()
{
clrscr();
cout<<"Enter new password : ";
char pass[4];
cin>>pass;
fstream fil;
fil.open("password.txt", ios::out);
fil<<pass;
fil.close();
Mainmenu();
}
void Mainmenu()
{
clrscr();
gotoxy(20,3); cout<<"GGG U U III TTT AAA RRRR SSS TTT OOO RRRR EEE ";
gotoxy(20,4); cout<<"G U U I T A A R R S T O O R R E
";
gotoxy(20,5); cout<<"G G U U I T AAA RRR SSS T O O RRR EEE ";
gotoxy(20,6); cout<<"G G U U I T A A R R S T O O R R E
";
gotoxy(20,7); cout<<"GGG UUU III T A A R R SSS T OOO R R EEE ";
gotoxy(26,11); cout<<"*^*^*^*^*^*^*^*^*^*^*^*^*^*";
gotoxy(26,12);
cout<<"<#########################>";
gotoxy(26,13);
cout<<"*#
#*";
gotoxy(26,14);
cout<<"<#
#>";
gotoxy(26,15);
cout<<"*#
#*";
gotoxy(26,16);
cout<<"<#
#>";
gotoxy(26,17);
cout<<"*#
#*";
gotoxy(26,18);
cout<<"<#
#>";
gotoxy(26,19);
cout<<"*#
#*";
gotoxy(26,20);
cout<<"<#
#>";
gotoxy(26,21);
cout<<"*#
#*";
gotoxy(26,22);
cout<<"<#########################>";
gotoxy(26,23);
cout<<"*v*v*v*v*v*v*v*v*v*v*v*v*v*";

Project: <Project Title> Developed By <Students Name> Page:#15/33

gotoxy(5,2); cout<<"
xxx";
gotoxy(5,3); cout<<"
OxXxO";
gotoxy(5,4); cout<<"
xXx";
gotoxy(5,5); cout<<"
OxXxO";
gotoxy(5,6); cout<<"
HHH";
gotoxy(5,7); cout<<"
HHH";
gotoxy(5,8); cout<<"
HHH";
gotoxy(5,9); cout<<"
HHH";
gotoxy(5,10);
cout<<"
HHH";
gotoxy(5,11);
cout<<"
HHH";
gotoxy(5,12);
cout<<"
HHH";
gotoxy(5,13);
cout<<" __HHH";
gotoxy(5,14);
cout<<" TxxHHH _";
gotoxy(5,15); cout<<" TxxxHHH_/xT";
gotoxy(5,16);
cout<<" Txxx*|||*xxxT";
gotoxy(5,17);
cout<<" Txxx*|||*xxxT";
gotoxy(5,18);
cout<<" Txxx|||xxxT";
gotoxy(5,19);
cout<<" Txxx|||xxxT";
gotoxy(5,20);
cout<<" Txxx|ooo|xxxT";
gotoxy(5,21);
cout<<"Txxxx+++++xxxxT";
gotoxy(5,22);
cout<<"TxxxxxxxxxxxxxT";
gotoxy(5,23);
cout<<" TxxxxxxxxxxxxT";
gotoxy(5,24);
cout<<" TxxxxxxxxxxT";
gotoxy(5,25);
cout<<" \xxxxxxxx/";
gotoxy(29,14);
cout<<"1.INVENTORY";
gotoxy(29,15);
cout<<"2.ORDERS";
gotoxy(29,16);
cout<<"3.SALES";
gotoxy(29,17);
cout<<"4.CHANGE PASSWORD";
gotoxy(29,18);
cout<<"5.DELETE ALL DATA";
gotoxy(29,19);
cout<<"6.EXIT";
gotoxy(29,14);
int pos;
char mover='0';
int y=14;
do
{
mover=getch();
if(mover==80)
{
if(y<19)
gotoxy(29,++y);
}
else if(mover==72)
{

Project: <Project Title> Developed By <Students Name> Page:#16/33

if(y>14)
gotoxy(29,--y);
}
}
while(mover!=13);
pos=wherey();
if(mover==13)
{
switch(pos)
{
case 14: Inventory(); break;
case 15: Orders(); break;
case 16: Sales(); break;
case 17: Changepword(); break;
case 18: Deletedata(); break;
case 19: break;
}
}
}

void Inventory()
{
clrscr();
int choice;
do
{
cout<<"\nChoose the required operation by typing in it's number -"
<<"\n1.Add new guitar to inventory"
<<"\n2.Search for a guitar in inventory"
<<"\n3.Remove a guitar from the inventory"
<<"\n4.Show inventory status"
<<"\n5.Return to main menu"<<endl;
cin>>choice;
switch(choice)
{
case 1: addguitar(); break;
case 2: search(); break;
case 3: removeguitar(); break;
case 4: showstatus(); break;
case 5: Mainmenu();
}
}
while(choice!=5);
}
void Orders()
{
clrscr();

Project: <Project Title> Developed By <Students Name> Page:#17/33

int choice;
do
{
cout<<"\nChoose the required operation by typing in it's number -"
<<"\n1.Register an order"
<<"\n2.Show pending orders"
<<"\n3.Process an order"
<<"\n4.Show processed orders"
<<"\n5.Return to main menu"<<endl;
cin>>choice;
switch(choice)
{
case 1: registero(); break;
case 2: showpending(); break;
case 3: processorder(); break;
case 4: showprocessed(); break;
case 5: Mainmenu();
}
}
while(choice!=5);
}
void Sales()
{
clrscr();
int choice;
do
{
cout<<"\nChoose the required operation by typing in it's number -"
<<"\n1.Net profit till date"
<<"\n2.Net revenue till date"
<<"\n3.Return to main menu"<<endl;
cin>>choice;
switch(choice)
{
case 1: profit(); break;
case 2: netrevenue(); break;
case 3: Mainmenu();
}
}
while(choice!=3);
}

Project: <Project Title> Developed By <Students Name> Page:#18/33

Output Screen
The code is password protected and to access it password must be provided (0000
is default password)

The main menu - Navigation by arrow keys and <ENTER> key. Sub-menus have
input based navigation

Project: <Project Title> Developed By <Students Name> Page:#19/33

Inventory menu

Option 1-

Project: <Project Title> Developed By <Students Name> Page:#20/33

Project: <Project Title> Developed By <Students Name> Page:#21/33

Option 2 -

Option 3 -

Project: <Project Title> Developed By <Students Name> Page:#22/33

Option 4

Option 5 Returns user to main menu

Project: <Project Title> Developed By <Students Name> Page:#23/33

Orders Menu

Option 1 -

Project: <Project Title> Developed By <Students Name> Page:#24/33

Option 2 -

Project: <Project Title> Developed By <Students Name> Page:#25/33

Option 3 - Note that processing an order causes guitar stock to deplete dependent
on the order

Option 4 -

Project: <Project Title> Developed By <Students Name> Page:#26/33

Option 5 Returns user to main menu

Sales Menu

Project: <Project Title> Developed By <Students Name> Page:#27/33

Option 1 -

Option 2 -

Project: <Project Title> Developed By <Students Name> Page:#28/33

Option 3 Returns user to main menu

Change Password

Project: <Project Title> Developed By <Students Name> Page:#29/33

After pressing enter on the above screen, password is changed and main menu
appears

Delete All Data Screen

Project: <Project Title> Developed By <Students Name> Page:#30/33

The Program exits after deleting all data. If user wants to exit without deleting data,
Exit on main menu can be used.

Re-running after deletion of all data (Background and text colours are randomized
for each run)

This is what Search for guitar option in Inventory menu shows -

Project: <Project Title> Developed By <Students Name> Page:#31/33

This is what Show pending orders option in Orders menu shows -

Project: <Project Title> Developed By <Students Name> Page:#32/33

Hardware & Software Requirement

Hardware Requirement
Intel core/i3/i5/i7 or any equivalent
With at least 256 MB RAM
2 MB free space on Hard Disk
Color Monitor/LCD

Operating System &


Compiler
MS Windows
Turbo C++ 3.1 Compiler

Project: <Project Title> Developed By <Students Name> Page:#33/33

You might also like