You are on page 1of 17

COMPUTER SCIENCE PROJECT

Music Store

Irfan Sheikh
XII-B

CONTENTS

CERTIFICATE
ACNOWLEGMENT
SYNOPSIS
PROGRAM CODE
OUTPUT SNAPSHOTS
BIBLIOGRAPHY

CERTIFICATE

This is to certify that Irfan Sheikh of class XII-B of


DAV PUBLIC SCHOOL, VASANT KUNJ carried out this
project MUSIC STORE under the guidance of Dr.
Pratibha Dwivedi. The work on this project is his
original work.

SIGNATURE
Ms. Pratibha Dwivedi
HOD (Computer Department)
DAV Public School, Vasant Kunj

ACKNOWLEDGEMEMT

I would like to thank our computer science


teacher Ms. Pratibha Dwivedi for her
constant support and encouragement
throughout this Music Store project. This
project couldnt have been possible
without her.

SYNOPSIS
Music Store is an Entertaining Program to fulfil all requirements of
Music lovers. It provides a user friendly interactive text mode screen
where user has the facility to record, modify, search, delete and
generate bill. It takes the inputs from the customer for their required
music and show their details if the record has been saved by the
Administrator. The program has the following options: 1. Upload Data.
2. Read Data.
3. Search for Data.
4. Modify Data.
5. Delete Data.
Upload Data- Here user enters all the data to generate bill, it asks the
favourite music no. and quantities of CDs required. These data are
required to generate bill on the program ask to continue after
completion of one record that way all customer data can entered into
the system.
Read All Data- This option retrieve all entered data for the
verification of the details of the customer. It shows all record one by
one.
Search for Data-Instead of reading all customer data the program has
a facility to search a particular customer data. For Example-It asks to
enter the music no. which is required to be searched and retrieve all
the information based on it.

Modify Data- If any discrepancy occurs during recording of the detail


of the customer, this option provides facility to upload the data. It
asks music no. then on that basis it provides option to change all the
details belonging to the music no. of that customer.
Delete Data- Since the modification of data provides limited facility to
update the record; it is very difficult to change other data of the
customer. In such cases the delete option deletes the complete
records of the customer so that the fresh record of the customer can
be entered.

HARDWARE AND
SOFTWARE

HARDWARE:
RAM
REQUIRED: - 512MB
AVAILABLE: - 2GB

HARD DISK:
REQUIRED: - 40GB
AVAILABLE: - 320GB

SOFTWARE:
OPERATING SYSTEM: -WINDOWS XP/WINDOWS 7
TURBO C++
MICROSOFT OFFICE (MS WORD)

THE C++ CODE


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
#include<math.h>
#include<stdlib.h>
class music
{
int mno;
char name[50];
float price,qty,tax,dis;
public:
void create_music()
{
cout<<"\nPlease Enter The Music No. of Your Favourite One ";
cin>>mno;
cout<<"\n\nPlease Enter The Name of The Music ";
gets(name);
cout<<"\nPlease Enter The Price of The Music CD You Want To
Purchase ";
cin>>price;
cout<<"\nPlease Enter The Discount (%) on the CD Written over
the Specific Cover ";
cin>>dis;
}
void show_music()
{
cout<<"\nThe Music No. You have choose : "<<mno;
cout<<"\nThe Name of The Music : ";
puts(name);
cout<<"\nThe Price of The Music CD : "<<price;
cout<<"\nDiscount : "<<dis;
}
int retmno()
{return mno;}
float retprice()
{return price;}

char* retname()
{return name;}
int retdis()
{return dis;}
};
fstream rockers;
music mu;
void write_music()
{
rockers.open("Collection.dat",ios::out|ios::app);
mu.create_music();
rockers.write((char*)&mu,sizeof(music));
rockers.close();
cout<<"\n\nThe Music CD Has Been Created ";
getch();
}
void display_all()
{
clrscr();
cout<<"\n\n\n\t\tDISPLAY ALL RECORD !!!\n\n";
rockers.open("Collection.dat",ios::in);
while(rockers.read((char*)&mu,sizeof(music)))
{
mu.show_music();
cout<<"\n\n====================================\n";
getch();
}
rockers.close();
getch();
}

void display_sp(int n)
{
int flag=0;
rockers.open("Collection.dat",ios::in);
while(rockers.read((char*)&mu,sizeof(music)))
{
if(mu.retmno()==n)
{
clrscr();
mu.show_music();
flag=1;
}
}
rockers.close();
if(flag==0)
cout<<"\n\nrecord not exist";
getch();
}

void modify_music()
{
int no,found=0;
clrscr();
cout<<"\n\n\tTo Modify ";
cout<<"\n\n\tPlease Enter The Music No. of Your Favourite One ";
cin>>no;
rockers.open("Collection.dat",ios::in|ios::out);
while(rockers.read((char*)&mu,sizeof(music)) && found==0)
{
if(mu.retmno()==no)
{
mu.show_music();
cout<<"\nPlease Enter The New Details of Music"<<endl;
mu.create_music();
int pos=-1*sizeof(music);
rockers.seekp(pos,ios::cur);
rockers.write((char*)&mu,sizeof(music));
cout<<"\n\n\t Record Updated";
found=1;
}
}
rockers.close();
if(found==0)
cout<<"\n\n Record Not Found ";
getch();
}
void delete_music()
{
int no;
clrscr();
cout<<"\n\n\n\tDelete Record";
cout<<"\n\nPlease Enter The Music no. of The Music You Want To
Delete(means You Hate)";
cin>>no;
rockers.open("Collection.dat",ios::in|ios::out);
fstream rockers2;
rockers2.open("Temp.dat",ios::out);
rockers.seekg(0,ios::beg);
while(rockers.read((char*)&mu,sizeof(music)))
{
if(mu.retmno()!=no)
{
rockers2.write((char*)&mu,sizeof(music));
}
}
rockers2.close();
rockers.close();
remove("Collection.dat");
rename("Temp.dat","Collection.dat");
cout<<"\n\n\tRecord Deleted ..";
getch();
}
void menu()

{
clrscr();
rockers.open("Collection.dat",ios::in);
if(!rockers)
{
cout<<"ERROR!!! MUSIC YOU WANT COULD NOT BE OPEN\n\n\n Go To
Admin Menu to create File";
cout<<"\n\n\n Program is closing ......Just Go And Check Another
Music Store";
getch();
exit(0);
}
cout<<"\n\n\t\tMUSIC MENU\n\n";
cout<<"====================================================\n";
cout<<"M.NO.\t\tNAME\t\tPRICE\n";
cout<<"====================================================\n";
while(rockers.read((char*)&mu,sizeof(music)))
{
cout<<mu.retmno()<<"\t\t"<<mu.retname()<<"\t\t"<<mu.retprice()<<endl;
}
rockers.close();
}

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 Music No. Of Your Favourite One : ";
cin>>order_arr[c];
cout<<"\nQuantity of CDs You Want in number : ";
cin>>quan[c];
c++;
cout<<"\nDo You Want To Order Another Music CD ? (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<<"\nMusic No.\tMusic Name\tQuantity \tPrice \tAmount
\tAmount after discount\n";
for(int x=0;x<=c;x++)
{
rockers.open("Collection.dat",ios::in);
rockers.read((char*)&mu,sizeof(music));

while(!rockers.eof())
{
if(mu.retmno()==order_arr[x])
{
amt=mu.retprice()*quan[x];
damt=amt-(amt*mu.retdis()/100);
cout<<"\n"<<order_arr[x]<<"\t"<<mu.retname()<<"\t"<<quan[x]<<"\t\t"<<mu
.retprice()<<"\t"<<amt<<"\t\t"<<damt;
total+=damt;
}
rockers.read((char*)&mu,sizeof(music));
}
rockers.close();
}
cout<<"\n\n\t\t\t\t\tTOTAL = "<<total;
getch();
}
void intro()
{
clrscr();
gotoxy(31,11);
cout<<"MUSIC WORLD-ALL HITS";
gotoxy(35,14);
cout<<"PURCHASING MUSIC CDs";
gotoxy(35,17);
cout<<"PROJECT";
cout<<"\n\nMADE BY : MRUTUNJAY AND IRFAN";
cout<<"\n\nSCHOOL : DAV PUBLIC SCHOOL";
cout<<"\n ADDRESS :VASANT KUNJ,NEW DELHI";
getch();
}

void musicmaster_menu()
{
clrscr();
char ch2;
cout<<"\n\n\n\tMUSIC MASTER MENU(ADMIN)";
cout<<"\n\n\t1.CREATE MUSIC";
cout<<"\n\n\t2.DISPLAY ALL MUSICS";
cout<<"\n\n\t3.QUERY ";
cout<<"\n\n\t4.MODIFY MUSIC";
cout<<"\n\n\t5.DELETE MUSIC";
cout<<"\n\n\t6.VIEW MUSIC 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_music();
break;

case '2': display_all();


break;
case '3':
int num;
clrscr();
cout<<"\n\n\tPlease Enter The Music No. ";
cin>>num;
display_sp(num);
break;
case '4': modify_music();
break;
case '5': delete_music();
break;
case '6': menu();
getch();
case '7': break;
default:cout<<"\a";musicmaster_menu();
}
}
void main()
{
char ch;
intro();
do
{
clrscr();
cout<<"\n\n\n\tMAIN MENU";
cout<<"\n\n\t01. CUSTOMERS(MUSIC LOVERS)";
cout<<"\n\n\t02. ADMINISTRATOR(MUSIC COLLECTORS)";
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': musicmaster_menu();
break;
case '3':exit(0);
default :cout<<"\a";
}
}while(ch!='3');
}

SNAPSHOTS

BIBLIOGRAPHY

CLASS NOTEBOOK
C++ COURSE BOOK BY SUMITA ARORA

You might also like