// Header files used in this project
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
// non member functions used in this project
void report_1();
void report_2();
void report_3();
void report_4();
void reports_menu();
void info();
void info()
{
cout<<" CBSE 2012 Boards Project: Super market management system"<<endl
<<" Programmer: Arsh Chauhan"<<endl
<<"Class XII-A"<<endl
<<" City International school"<<endl
<<"Teacher: Mrs. Shailaja Patil";
}
class employee
{ char name[31];
char gender;
unsigned int age;
unsigned int employee_ID;
float salary;
float commissions;
float total_salary;
char post[11];
unsigned int employee_count;
public:
void calc_total_salary()
{
total_salary=salary+commissions;
}
char* get_name()
{ return(name);
}
void show_name()
{cout<<"Employee Name:"<<name;
}
void show_employee()
{ cout<<"\n Employee ID: \t"<<employee_ID;
cout<<" \n Name: \t"<<name;
cout<<"\n Age: \t"<<age;
cout<<"\n Salary: \t"<<total_salary;
cout<<"\n Commissions for the current month: \t"<<commissions;
cout<<"\n Total Salary for the month: \t"<<total_salary;
cout<<"\n Gender: \t"<<gender;
cout<<"\n Post: \t"<<post;
}
void get_employee()
{
cout<<"\n Enter Employee ID: ";
cin>>employee_ID;
cout<<" \n Enter Name:";
gets(name);
cout<<"\n Enter Age:";
cin>>age;
cout<<"\n Enter Salary:";
cin>>salary;
cout<<"\n Enter Commissions for the current month:";
cin>>commissions;
cout<<"\n Enter Gender: \t";
cin>>gender;
cout<<"\n Enter Post:";
cin>>post;
calc_total_salary();
}
};
class customer
{ char name[31];
char gender;
unsigned int age;
int membership_ID;
unsigned long int royalty_points;
static unsigned int count_1;
public:
void show_customer()
{
cout<<"\n Membership ID :\t "<<membership_ID;
if (gender=='M')
cout<<" \n Name: \t"<<"Mr."<<name;
else
cout<<"\n Name: \t"<<"Mrs."<<name;
cout<<"\n Age: \t"<<age<<" Years";
cout<<" Current Royalty Points: \t"<<royalty_points;
}
void get_customer()
{
membership_ID=count_1+1;
cout<<"Enter Name:";
gets(name);
cout<<"Enter Age:";
cin>>age;
cout<<"Enter Gender(M/F)";
cin>>gender;
}
void edit_customer()
{
do
{
clrscr();
int choice;
cout<<" \n Enter your choice :\t";
cout<<"\n 1) Change name of Customer:\t";
cout<<"\n 2) Change Age of customer :\t";
cout<<"\n 3) Change customer ID of customer :\t";
cout<<"\n 4) Change Gender of customer:\t";
cout<<"\n 5) Exit \t";
cin>> choice;
switch(choice)
{ case 1:{ cout<<"\n Enter new name of customer: \t";
cin>>name;
}
break;
case 2:{ cout<<" \n Enter New Age of the customer: \t";
cin>>age;
}
break;
case 3:{ cout<<"\n The customer ID cannot be changed";}
break;
case 4:{ cout<<"\n Enter Corrected Gender of Customer: \t";
cin>>gender;
}
break;
default: cout<<" \n Please enter a valid choice";
}}
while(choice!=5);
}
int customer_search()
{
return (membership_ID);
}
void show_report_2()// function to show customer name and ID used in report 2
{
cout<<"\n Name: ";
puts(name);
cout<<"membership_ID: "<<membership_ID;
}
};
unsigned int customer::count_1=0;
class stock
{
char item_name[16];
unsigned int stock_obtained;
unsigned int stock_sold;
unsigned long int item_price;
unsigned long int item_code;
unsigned long int stock_remaining;
public:
void get_stock()
{
cout<"Enter Item name:";
gets(item_name);
cout<<"/n Enter item code :";
cin>>item_code;
cout<<"/n Enter item Price";
cin>>item_price;
cout<<"/n Enter stock obtained";
cin>>stock_obtained;
}
void increment_count_sold()
{
stock_sold=stock_sold+1;
stock_remaining=stock_obtained-stock_sold;
}
unsigned int show_stock_remaining()
{
return(stock_remaining);
}
unsigned long int get_item_price()
{
return(item_price);
}
char* get_name()
{
return (item_name);
}
void show_report_4()
{
cout<<"/n Item Name: ";
for(int i=0;i<4;i++)
{goto(i,5);
puts(item_name);
}
cout<<"Stcok remaining";
for(int i=0;i<5;i++)
{ goto(i,5);
cout<<stock_remaining;
}
}
void display_item_info()
{
cout<<"\n Item Code: \t"<<item_code;
cout<<" \n item Name: \t"<<item_name;
cout<<"\n Price : \t"<<item_price<<" INR "<<" Inclusive of All Taxes";
cout<<"\n Stock Sold: \t"<<stock_sold;
cout<<"\n Stock remaining:\t"<<stock_remaining;
if(stock_remaining<=10)
{
cout<<"\n Order new batch of : ";
cout<< "\n Item name: \t"<<item_name;
cout<<"\n Item Code: \t"<<item_code;
}
}
};
class order
{
unsigned long int order_no;
unsigned long int order_date_dd;
unsigned long int order_date_mm;
unsigned long int order_date_yyyy;
unsigned long int amount;
unsigned long int total;
float discount;
public:
void get_info();
void show_info();
void enter_date();
};
void order::enter_date()
{
cout<<"Enter today's date";
cout<<"/n Enter date(dd)";
cin>>order_date_dd;
cout<<"/n Enter month(mm)";
cin>>order_date_mm;
cout<<"/n Enter Year(yyyy)";
cin>>order_date_yyyy;
}
void report_1(stock *s1)// report to show all items wihin the given range
{ clrscr();
long int start_price,end_price;
cout<<"Enter starting of price range";
cin>>start_price;
cout<<"/n Enter ending price";
cin>>end_price;
unsigned long int price;
int flag=0;
for(int i=0;i<100;i++)
{
price=s1[i].get_item_price();
if((price>=start_price)&&(price<=end_price))
{flag=1;
cout<<"/n|Item Name";
s1[i].get_name();
}
}
if(flag==0)
{
cout<<"No items found within given range";
}
}
void report_2()//Report to show list of royalty program customers.
{ clrscr();
cout<<"/n List of all Royalty program customers";
cout<<"|Customer ID|";
for(int i=0;i<100;i++)
{
void show_report_2();
}
}
void report_3(employee &e1)// Report to show the names of all employees having a particular post
{ clrscr();
char temp_post[11];
char temp[11];
cout<<"Enter post to be searched for:";
gets(temp_post);
for(int i=0;i<50;i++)
{
temp=e1[i].get_name();
if(strcmp(temp_post,temp)==0)
{
e1[i].show_name();
}
}
}
void report_4(stock *s2) //Report to Show the item stock report
{ clrscr();
cout<<"The current item stocks are as follows:";
for(int i=0;i<100;i++)
{
s2[i].show_report_4();// Function defined in Class stock body
}
}
void main()
{ clrscr();
info();
clrscr();
employee E[50];
customer C[100];
stock I[100];
int choice;
cout<<" Enter your choice :"<<endl
<<"1)Add new customer"<<endl
<<"2)Add new employee"<<endl
<<"3)Edit Customer"<<endl
<<"4)Add new item"<<endl
<<"5)Search an item"<<endl
<<"6)View report";
cin>>choice;
switch(choice)
{
case 1: get_customer();
break;
case 2: get_employee();
break;
case 3: { cout<<"Enter Cutomer ID of customer to be editted";
int check,check_1;
for(int i=0;i<100;i++)
{
check_1=C[i].customer_search();
if(check==check_1)
C[i].edit_customer();
}
}
break;
case 4: get_stock();
break;
case 5: { cout<<"Enter the item name you want to search";
char search[16],search_1[16];
gets(search);
int flag=0;
for(int i=0;i<100;i++)
{
search_1=I[i].get_name();
if(strcmp(search_1,search)==0)
{flag=1;
I[i].display_item_info();
}
}
if(flag==0)
cout<<"/n Item not found";
}
break;
case 6: {clrscr();
int choice;
cout<<"Enter you choice";
cout<<" 1) List of all items within a given range of prices"
<<" /n2) List of raoyalty program customers"
<<" /n3) List of employees holding selected post"
<<" /n4) Item Stock report"
<<" /n5) Exit";
cin>>choice;
while(choice!=5)
switch(choice)
{
case 1: report_1(*I);
break;
case 2: report_2();
break;
case 3: report_3(*E);
break;
case 4: report_4();
break;
default: cout<<"please enter a valid choice";
}
}
break;
default: cout<<"Invalid choice entered";
}
}