This is the proJect
<br />
<br />
#include <iostream.h><br />
#include <string.h><br />
#include <stdio.h><br />
#include <math.h><br />
<br />
const int MaxNoOfPlants=100;
const int MaxNoOfCustomers=20;
int menu=0;
int NoOfPlants=0;
int NoOfCustomers=0;
int counterP=0;
int counterC=0;
int FindCustomerList=0;
int FindPlantList=0;
<br />
<br />
<br />
class Order1 {
public:
<br />
char Order[40];
int Quantity;
float Invoice;
};<br />
<br />
<br />
class Plant {
public:<br />
char PlantFamily_Name[40];
<br />
char Type[8];
char Colour[10];
char Size[8];
int NumOfThisInStock;
char ItIsGarden[3];
float Price;
int QSell;
<br />
char QName[40];
<br />
};<br />
<br />
class Customer {
public:<br />
char Name[30];
char Address[80];
char Phone[10];
char SocialSecurityNum[15];
int HowM;
float TotalInvoice;
float TurnOver;
<br />
Order1 Or[10];<br />
<br />
<br />
};<br />
<br />
<br />
Plant PDBase[MaxNoOfPlants];<br />
Customer CDBase[MaxNoOfCustomers];<br />
<br />
void ShowMenu ();<br />
<br />
void ChooseMenu (int menu);<br />
<br />
void ReadNewPlant ();<br />
<br />
void ReadNewCustomer ();<br />
<br />
void HowManyPlants ();<br />
<br />
void DisplayPlants ();<br />
<br />
void DisplayCustomers ();<br />
<br />
void HowManyCustomers ();<br />
<br />
void FindCustomer();<br />
<br />
void ModifyCustomer ();<br />
<br />
void FindPlant ();<br />
<br />
void ModifyPlant ();<br />
<br />
void DeleteC ();<br />
<br />
void DeleteP ();<br />
<br />
void InsertOrder ();<br />
<br />
void MakeOrder ();<br />
<br />
void ShowOrder ();<br />
<br />
void ModifyOrder ();<br />
<br />
void ViewOrder ();<br />
<br />
void ReportChoose ();<br />
<br />
void FindCustBiggerTurnover ();<br />
<br />
void FindPlantWhosePriceIs ();<br />
<br />
void TopSell ();<br />
<br />
void TopSell5 ();<br />
<br />
void TopSell5Display ();<br />
<br />
void TopSell1 ();<br />
<br />
<br />
<br />
<br />
void TopSell1 ()<br />
{ <br />
int i,j;<br />
char tempName[40];
int tempQSell;
<br />
for(i=0; i<NoOfPlants; i++)
{<br />
for(j=0; j<NoOfPlants; j++)
{<br />
<br />
if (PDBase[i].QSell>PDBase[j].QSell)
<br />
{<br />
<br />
strcpy(tempName, PDBase[i].QName); <br />
tempQSell=PDBase[i].QSell;<br />
<br />
strcpy(PDBase[i].QName, PDBase[j].QName);<br />
PDBase[i].QSell=PDBase[j].QSell;<br />
<br />
strcpy(PDBase[j].QName, tempName);<br />
PDBase[j].QSell=tempQSell;<br />
}<br />
}<br />
}<br />
cout<<"The Top Selling Plant Is: \n";<br />
for(i=0; i<1; i++)<br />
{<br />
cout<<"\nPLANT'S NAME: "<<PDBase[i].QName<<endl;<br />
cout<<"SELL QUANTITY : "<<PDBase[i].QSell<<endl;<br />
cout<<"______________________________\n";<br />
}<br />
<br />
}<br />
<br />
void TopSell5Display ()<br />
{<br />
int i;<br />
<br />
for(i=0; i<5; i++)<br />
{<br />
cout<<"______________________________\n";<br />
cout<<"PLANT #: "<<i+1<<endl;<br />
cout<<"PLANT'S NAME : "<<PDBase[i].QName<<endl;<br />
cout<<"SELL QUANTITY : "<<PDBase[i].QSell<<endl;<br />
cout<<"______________________________\n";<br />
<br />
<br />
}<br />
<br />
}<br />
<br />
<br />
void TopSell5 ()<br />
{ <br />
int i,j;<br />
char tempName[40];<br />
int tempQSell;<br />
<br />
for(i=0; i<NoOfPlants; i++)<br />
{<br />
for(j=0; j<NoOfPlants; j++)<br />
{<br />
<br />
if (PDBase[i].QSell>PDBase[j].QSell)
<br />
{<br />
strcpy(tempName, PDBase[i].QName);<br />
tempQSell=PDBase[i].QSell;<br />
<br />
strcpy(PDBase[i].QName, PDBase[j].QName);<br />
PDBase[i].QSell=PDBase[j].QSell;<br />
<br />
strcpy(PDBase[j].QName, tempName);<br />
PDBase[j].QSell=tempQSell;<br />
}<br />
}<br />
}<br />
<br />
cout<<"The 5 Top Selling Plants Are: \n";<br />
TopSell5Display ();
<br />
}<br />
<br />
<br />
void TopSell ()<br />
{<br />
int i;<br />
<br />
for(i=0; i<NoOfPlants; i++)<br />
{<br />
strcpy(PDBase[i].QName, PDBase[i].PlantFamily_Name);<br />
}<br />
TopSell5 ();<br />
<br />
}<br />
<br />
void FindPlantWhosePriceIs ()<br />
{<br />
<br />
int i;<br />
float Price1;
float Price2;
<br />
cout<<"Please Enter From What Price: \n";<br />
cin>>Price1;<br />
cout<<"And Up To What Price: \n";<br />
cin>>Price2;<br />
<br />
cout<<"\n**PLANTS WHOSE PRICE IS BETWEEN "<<Price1<< " & "<<Price2<<"**\n";<br />
<br />
for(i=0; i<NoOfPlants; i++)<br />
{ <br />
if((PDBase[i].Price>=Price1)&&(PDBase[i].Price<=Price2))
{<br />
cout<<"\nPLANT #: "<<i+1<<endl;<br />
cout<<"FAMILY & NAME: "<<PDBase[i].PlantFamily_Name<<endl;
cout<<"TYPE : "<<PDBase[i].Type<<endl;
cout<<"COLOUR : "<<PDBase[i].Colour<<endl;<br />
cout<<"SIZE : "<<PDBase[i].Size<<endl;<br />
cout<<"IN STOCK : "<<PDBase[i].NumOfThisInStock<<endl;<br />
cout<<"GARDEN PLANT : "<<PDBase[i].ItIsGarden<<endl;<br />
cout<<"PRICE : "<<PDBase[i].Price<<endl;<br />
cout<<"____________________________\n\n";<br />
}<br />
}<br />
}<br />
<br />
<br />
void FindCustBiggerTurnover ()<br />
{<br />
int i;<br />
int count=0;<br />
float FBig=0;<br />
<br />
<br />
FBig=CDBase[0].TotalInvoice;<br />
i=1;<br />
<br />
while(i<NoOfCustomers)<br />
{<br />
if(CDBase[i].TurnOver>FBig)
{
FBig=CDBase[i].TurnOver;<br />
count=i;
}<br />
i++;<br />
}<br />
<br />
cout<<"\nCustomer With The Bigger Turnover: \n";
cout<<"Customer #: "<<count+1<<endl;
cout<<"NAME : "<<CDBase[count].Name<<endl;<br />
cout<<"TURNOVER :"<<CDBase[count].TurnOver<<endl<<endl;<br />
}<br />
<br />
<br />
void ReportChoose ()<br />
{<br />
int menuR;<br />
<br />
cout<<"\n\n**REPORT MENU**\n";<br />
cout<<"____________________\n";<br />
<br />
<br />
cout<<"\n1.Information Of A Particular Plant\n";<br />
cout<<"2.Information Of A Particular Customer\n";<br />
cout<<"3.Information On The Top 5 Selling Plants\n";<br />
cout<<"4.Information On The Top Selling Plant\n";<br />
cout<<"5.Information On A Customer With The Biggest Turnover\n";<br />
cout<<"6.Information On Plants Whose Price Is Between...\n";<br />
cout<<"7.RETURN TO MAIN MENU\n";<br />
<br />
cout<<"\nPlease Make Your Choice: "<<endl;<br />
cin>>menuR;<br />
<br />
<br />
switch (menuR)
{<br />
<br />
case 1:
{<br />
FindPlant ();<br />
cout<<"\n\nPLANT #: "<<FindPlantList+1<<endl;<br />
cout<<"FAMILY & NAME: "<<PDBase[FindPlantList].PlantFamily_Name<<endl;<br />
cout<<"TYPE : "<<PDBase[FindPlantList].Type<<endl;<br />
cout<<"COLOUR : "<<PDBase[FindPlantList].Colour<<endl;<br />
cout<<"SIZE : "<<PDBase[FindPlantList].Size<<endl;<br />
cout<<"IN STOCK : "<<PDBase[FindPlantList].NumOfThisInStock<<endl;<br />
cout<<"GARDEN PLANT : "<<PDBase[FindPlantList].ItIsGarden<<endl;<br />
cout<<"PRICE : "<<PDBase[FindPlantList].Price<<endl;<br />
cout<<endl<<endl;<br />
break;<br />
}<br />
<br />
case 2:
{<br />
FindCustomer();<br />
cout<<"\n\nCUSTOMER #: "<<FindCustomerList+1<<endl;<br />
cout<<"NAME : "<<CDBase[FindCustomerList].Name<<endl;<br />
cout<<"ADDRESS : "<<CDBase[FindCustomerList].Address<<endl;<br />
cout<<"PHONE NUMBER : "<<CDBase[FindCustomerList].Phone<<endl;<br />
cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
cout<<endl<<endl;<br />
break;<br />
}<br />
<br />
case 3:
{<br />
TopSell ();<br />
break;<br />
}<br />
<br />
case 4:
{<br />
TopSell1 ();<br />
break;<br />
<br />
}<br />
case 5:
{<br />
FindCustBiggerTurnover ();<br />
break;<br />
<br />
}<br />
<br />
case 6:
<br />
{<br />
FindPlantWhosePriceIs ();<br />
break;<br />
}<br />
<br />
<br />
case 7:
{<br />
<br />
ShowMenu ();<br />
cout<<"Choose an action: ";<br />
cin>>menu;<br />
ChooseMenu(menu);<br />
break;<br />
<br />
}<br />
<br />
default:
{<br />
ReportChoose ();<br />
break;<br />
<br />
<br />
}<br />
}<br />
}<br />
<br />
<br />
<br />
void ViewOrder ()<br />
{<br />
cout<<"**VIEW ORDER**\n";<br />
cout<<"Find The Customer How Make That Order\n";<br />
FindCustomer();
cout<<"\n*SELECTED CUSTOMER*\n";<br />
cout<<"_______________________\n"; <br />
cout<<"CUSTOMER #: "<<FindCustomerList+1<<endl;
cout<<"NAME : "<<CDBase[FindCustomerList].Name<<endl;<br />
cout<<"ADDRESS : "<<CDBase[FindCustomerList].Address<<endl;<br />
cout<<"PHONE NUMBER : "<<CDBase[FindCustomerList].Phone<<endl;<br />
cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
cout<<endl<<endl;<br />
<br />
cout<<"This Is His/Her Order\n";<br />
cout<<"_________________\n";<br />
ShowOrder ();
<br />
<br />
}<br />
<br />
void ModifyOrder ()<br />
{<br />
char q;<br />
char choice1;<br />
int i;<br />
float inv=0.0;
int plus=0;
float tempInvoice=0.0;
int tempQuantity=0;
<br />
<br />
cout<<"**MODIFY ORDER**\n";<br />
cout<<"Find The Customer How Make That Order\n";<br />
FindCustomer();
cout<<"\n*SELECTED CUSTOMER*\n";<br />
cout<<"_______________________\n"; <br />
cout<<"CUSTOMER #: "<<FindCustomerList+1<<endl;<br />
cout<<"NAME : "<<CDBase[FindCustomerList].Name<<endl;<br />
cout<<"ADDRESS : "<<CDBase[FindCustomerList].Address<<endl;<br />
cout<<"PHONE NUMBER : "<<CDBase[FindCustomerList].Phone<<endl;<br />
cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
cout<<endl<<endl;<br />
<br />
cout<<"This Is His/Her Order\n";<br />
cout<<"_________________\n";<br />
ShowOrder ();
<br />
cout<<"\nAre You Sure You Want To Modify This Order? (y or n):\n";
cin>>q;
<br />
if((q=='y')||(q=='Y'))
{<br />
<br />
cout<<"If You Want To Change Only The Quantity Of The Plants Of The Last Order Enter 1.\n";<br />
cout<<"If You Want To Insert More Different Plants In Your Order Enter 2.\n";<br />
cout<<"If You Want To Make A New Order For That Customer Enter 3.\n";<br />
cin>>choice1;
<br />
if(choice1=='1')
<br />
{ tempInvoice=CDBase[FindCustomerList].TotalInvoice;<br />
<br />
cout<<"*Change The Quantity*\n";<br />
cout<<"\nCUSTOMER'S NAME: "<<CDBase[FindCustomerList].Name<<endl;<br />
for(i=0; i<CDBase[FindCustomerList].HowM; i++)<br />
{<br />
<br />
cout<<"PLANT # : "<<i+1<<endl;<br />
cout<<"Name: : "<<CDBase[FindCustomerList].Or[i].Order<<endl;<br />
cout<<"In Order To Continue\n";<br />
FindPlant ();
tempQuantity=PDBase[FindPlantList].QSell;
cout<<"New Quantity: "<<endl;
cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
<br />
if(PDBase[FindPlantList].NumOfThisInStock==0)
{
cout<<"There Are No Such Plants In Stock\n";<br />
<br />
}<br />
if(CDBase[FindCustomerList].Or[i].Quantity>PDBase[FindPlantList].NumOfThisInStock)<br />
{<br />
cout<<"Order Stoped\n";<br />
cout<<"Available Quantity For This Is: "<<PDBase[FindPlantList].NumOfThisInStock<<endl;<br />
cout<<"\nPlease Change Quantity. New Quantity: \n";
cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
}<br />
PDBase[FindPlantList].NumOfThisInStock=PDBase[FindPlantList].NumOfThisInStock-CDBase[FindCustomerList].Or[i].Quantity;<br />
CDBase[FindCustomerList].Or[i].Invoice=CDBase[FindCustomerList].Or[i].Quantity*PDBase[FindPlantList].Price;<br />
inv=inv+CDBase[FindCustomerList].Or[i].Invoice;<br />
CDBase[FindCustomerList].TotalInvoice=inv;<br />
PDBase[FindPlantList].QSell=PDBase[FindPlantList].QSell+CDBase[FindCustomerList].Or[i].Quantity-tempQuantity;<br />
CDBase[FindCustomerList].TurnOver=CDBase[FindCustomerList].TurnOver+CDBase[FindCustomerList].TotalInvoice-tempInvoice;<br />
}<br />
<br />
<br />
<br />
}<br />
if(choice1=='2')
{<br />
cout<<"*Insert More*\n";<br />
cout<<"\nCUSTOMER'S NAME: "<<CDBase[FindCustomerList].Name<<endl;<br />
<br />
cout<<"\nHow Many Different Plants Do You Want To Insert To Your Order?: \n";<br />
cin>>plus; <br />
<br />
for(i=CDBase[FindCustomerList].HowM; i<CDBase[FindCustomerList].HowM+plus; i++)<br />
{<br />
<br />
cout<<"PLANT #: "<<i+1<<endl;
FindPlant ();
cout<<"SELECTED PLANT: "<<PDBase[FindPlantList].PlantFamily_Name <<endl;<br />
cout<<"Quantity: "<<endl;
cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
<br />
if(PDBase[FindPlantList].NumOfThisInStock<=0)
{<br />
cout<<"There Are No Such Plants In Stock\n";
cout<<"Please Change Your Order.\n";<br />
cout<<"PLANT #: "<<i+1<<endl;<br />
FindPlant ();
cout<<"SELECTED PLANT: "<<PDBase[FindPlantList].PlantFamily_Name <<endl;<br />
cout<<"Quantity: \n";
cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
<br />
}<br />
if(CDBase[FindCustomerList].Or[i].Quantity>PDBase[FindPlantList].NumOfThisInStock)<br />
{<br />
cout<<"Order Stoped\n";<br />
cout<<"Available Quantity For This Is: "<<PDBase[FindPlantList].NumOfThisInStock<<endl;<br />
cout<<"\nPlease Change Quantity. New Quantity: \n";<br />
cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
<br />
}<br />
strcpy(CDBase[FindCustomerList].Or[i].Order, PDBase[FindPlantList].PlantFamily_Name);<br />
PDBase[FindPlantList].NumOfThisInStock=PDBase[FindPlantList].NumOfThisInStock-CDBase[FindCustomerList].Or[i].Quantity;<br />
CDBase[FindCustomerList].Or[i].Invoice=CDBase[FindCustomerList].Or[i].Quantity*PDBase[FindPlantList].Price;<br />
PDBase[FindPlantList].QSell=PDBase[FindPlantList].QSell+CDBase[FindCustomerList].Or[i].Quantity;<br />
inv=inv+CDBase[FindCustomerList].Or[i].Invoice;<br />
<br />
cout<<"Continue.\n";<br />
<br />
}<br />
CDBase[FindCustomerList].HowM=CDBase[FindCustomerList].HowM+plus;<br />
CDBase[FindCustomerList].TotalInvoice=CDBase[FindCustomerList].TotalInvoice+inv;<br />
CDBase[FindCustomerList].TurnOver=CDBase[FindCustomerList].TurnOver+CDBase[FindCustomerList].TotalInvoice;<br />
}<br />
if(choice1=='3')
{<br />
cout<<"*MAKE NEW ORDER*\n";<br />
cout<<"Please Enter How Many Different Plants You Are Going To Order: \n";<br />
cin>>CDBase[FindCustomerList].HowM;<br />
MakeOrder ();<br />
<br />
}<br />
<br />
<br />
<br />
}<br />
else
cout<<"\n**ACTION CANCELED**\n";<br />
<br />
<br />
}<br />
<br />
<br />
<br />
void ShowOrder ()<br />
{<br />
int i;<br />
<br />
cout<<"\nCUSTOMER'S NAME: "<<CDBase[FindCustomerList].Name<<endl;
cout<<"*ORDER*\n"; <br />
for(i=0; i<CDBase[FindCustomerList].HowM; i++)<br />
{<br />
<br />
<br />
cout<<"\nPLANT # : "<<i+1<<endl;
cout<<"Name: : "<<CDBase[FindCustomerList].Or[i].Order<<endl;
cout<<"Quantity: "<<CDBase[FindCustomerList].Or[i].Quantity<<endl;
cout<<"COST : "<<CDBase[FindCustomerList].Or[i].Invoice<<endl; <br />
<br />
cout<<"__________________________________________\n\n";<br />
<br />
}<br />
cout<<"INVOICE : "<<CDBase[FindCustomerList].TotalInvoice<<endl; <br />
cout<<"__________________________________________\n\n";<br />
<br />
cout<<"TURNOVER: "<<CDBase[FindCustomerList].TurnOver<<endl<<endl;<br />
<br />
}<br />
<br />
<br />
<br />
void MakeOrder ()<br />
{<br />
int i;<br />
float inv=0.0;<br />
<br />
<br />
<br />
cout<<"\n*SELECT PLANTS*\n";<br />
<br />
for(i=0; i<CDBase[FindCustomerList].HowM; i++)<br />
{<br />
cout<<"PLANT #: "<<i+1<<endl; <br />
FindPlant ();
<br />
cout<<"SELECTED PLANT: "<<PDBase[FindPlantList].PlantFamily_Name <<endl;<br />
<br />
cout<<"Quantity: "<<endl;<br />
cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
<br />
if(PDBase[FindPlantList].NumOfThisInStock<=0)
{<br />
cout<<"There Are No Such Plants In Stock\n";
cout<<"Please Change Your Order.\n";<br />
cout<<"PLANT #: "<<i+1<<endl;<br />
FindPlant ();<br />
cout<<"SELECTED PLANT: "<<PDBase[FindPlantList].PlantFamily_Name <<endl;<br />
cout<<"Quantity: \n";<br />
cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
}<br />
<br />
if(CDBase[FindCustomerList].Or[i].Quantity>PDBase[FindPlantList].NumOfThisInStock)<br />
{<br />
cout<<"Order Stoped\n";<br />
cout<<"Available Quantity For This Is: "<<PDBase[FindPlantList].NumOfThisInStock<<endl;<br />
<br />
cout<<"\nPlease Change Quantity. New Quantity: \n";<br />
cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
}<br />
<br />
strcpy(CDBase[FindCustomerList].Or[i].Order, PDBase[FindPlantList].PlantFamily_Name);<br />
<br />
PDBase[FindPlantList].NumOfThisInStock=PDBase[FindPlantList].NumOfThisInStock-CDBase[FindCustomerList].Or[i].Quantity;<br />
CDBase[FindCustomerList].Or[i].Invoice=CDBase[FindCustomerList].Or[i].Quantity*PDBase[FindPlantList].Price;<br />
inv=inv+CDBase[FindCustomerList].Or[i].Invoice;<br />
PDBase[FindPlantList].QSell=PDBase[FindPlantList].QSell+CDBase[FindCustomerList].Or[i].Quantity;<br />
cout<<"Continue.\n";<br />
<br />
}<br />
CDBase[FindCustomerList].TotalInvoice=inv;<br />
CDBase[FindCustomerList].TurnOver=CDBase[FindCustomerList].TurnOver+CDBase[FindCustomerList].TotalInvoice;<br />
<br />
ShowOrder ();<br />
<br />
<br />
<br />
<br />
}<br />
<br />
<br />
<br />
<br />
void InsertOrder ()<br />
{<br />
char q1;
char q2;
char q3;
<br />
int HowMany;<br />
<br />
cout<<"\n\t\t**ORDERING PROCESS**\n";<br />
<br />
cout<<"Are You Sure You Want To Continue Making An Order (y or n): "<<endl;<br />
cin>>q1;<br />
<br />
if((q1=='y')||(q1=='Y'))
{<br />
cout<<"\n**FIND CUSTOMER**\n";<br />
<br />
cout<<"Do You Want To Show First The Customers Are In The Database (y or n): "<<endl;<br />
cin>>q2;<br />
if((q2=='y')||(q2=='Y'))
{<br />
DisplayCustomers ();
cout<<"\nThese Are The Customers In The List\n";<br />
cout<<"\n*Select Customer*\n";<br />
<br />
FindCustomer();<br />
}<br />
else<br />
{<br />
cout<<"\n*SELECTED CUSTOMER*\n";<br />
FindCustomer();
}<br />
cout<<"\n*SELECTED CUSTOMER*\n";<br />
cout<<"_______________________\n"; <br />
cout<<"CUSTOMER #: "<<FindCustomerList+1<<endl;<br />
cout<<"NAME : "<<CDBase[FindCustomerList].Name<<endl;<br />
cout<<"ADDRESS : "<<CDBase[FindCustomerList].Address<<endl;<br />
cout<<"PHONE NUMBER : "<<CDBase[FindCustomerList].Phone<<endl;<br />
cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
cout<<endl<<endl;<br />
<br />
cout<<"*NOW YOU CAN INSERT THE ORDER*\n";<br />
<br />
cout<<"Do You Want To Show The Plants Are In The Database (y or n): \n";<br />
cin>>q3;<br />
<br />
if((q3=='y')||(q3=='Y'))
{<br />
<br />
cout<<"\n\n**SHOW AVAILABLE PLANTS**"<<endl;<br />
DisplayPlants ();<br />
cout<<"\nThese Are The Available Plants\n\n";<br />
<br />
cout<<"Please Enter How Many Different Plants You Are Going To Order:\n";<br />
cin>>HowMany; <br />
}<br />
<br />
else<br />
{<br />
cout<<"Please Enter How Many Different Plants You Are Going To Order:\n";<br />
cin>>HowMany;<br />
}<br />
<br />
CDBase[FindCustomerList].HowM=HowMany;<br />
<br />
MakeOrder ();<br />
<br />
}<br />
<br />
else<br />
cout<<"*ACTION CANCELED*"<<endl;<br />
}<br />
<br />
<br />
<br />
<br />
void DeleteP ()<br />
{<br />
int i;<br />
char YorN;<br />
<br />
cout<<"\n**DELETE PLANT FROM DATABASE**\n";<br />
cout<<"_________________________________\n";<br />
<br />
FindPlant ();
<br />
cout<<"PLANT #: "<<FindPlantList+1<<endl;<br />
cout<<"FAMILY & NAME: "<<PDBase[FindPlantList].PlantFamily_Name<<endl;<br />
cout<<"TYPE : "<<PDBase[FindPlantList].Type<<endl;
cout<<"COLOUR : "<<PDBase[FindPlantList].Colour<<endl;
cout<<"SIZE : "<<PDBase[FindPlantList].Size<<endl;
cout<<"IN STOCK : "<<PDBase[FindPlantList].NumOfThisInStock<<endl;
cout<<"GARDEN PLANT : "<<PDBase[FindPlantList].ItIsGarden<<endl;<br />
cout<<"PRICE : "<<PDBase[FindPlantList].Price<<endl;<br />
cout<<endl;<br />
<br />
cout<<"Are You Sure You Want To Delete This Plant (y or n): "<<endl;<br />
cin>>YorN;<br />
<br />
if((YorN=='y')||(YorN=='Y'))
{<br />
for(i=FindPlantList; i<NoOfPlants; i++)
{
<br />
strcpy(PDBase[i].PlantFamily_Name, PDBase[i+1].PlantFamily_Name);
strcpy(PDBase[i].Type, PDBase[i+1].Type);<br />
strcpy(PDBase[i].Size, PDBase[i+1].Size);<br />
PDBase[i].NumOfThisInStock=PDBase[i+1].NumOfThisInStock;<br />
strcpy(PDBase[i].ItIsGarden, PDBase[i+1].ItIsGarden);<br />
PDBase[i].Price=PDBase[i+1].Price;<br />
}<br />
NoOfPlants=NoOfPlants-1;
if (NoOfPlants < 0)<br />
{<br />
NoOfPlants=0;
}<br />
cout<<"*PLANT DELETED*"<<endl;<br />
}<br />
else<br />
cout<<"*ACTION CANCELED*"<<endl;<br />
}<br />
<br />
<br />
void DeleteC ()<br />
{<br />
int i;<br />
char YorN;<br />
<br />
cout<<"\n**DELETE CUSTOMER FROM DATABASE**\n";<br />
cout<<"_________________________________\n";<br />
<br />
FindCustomer();
<br />
cout<<"CUSTOMER #: "<<FindCustomerList+1<<endl;<br />
cout<<"NAME : "<<CDBase[FindCustomerList].Name<<endl;
cout<<"ADDRESS : "<<CDBase[FindCustomerList].Address<<endl;<br />
cout<<"PHONE NUMBER : "<<CDBase[FindCustomerList].Phone<<endl;<br />
cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
cout<<endl<<endl;<br />
<br />
<br />
cout<<"Are You Sure You Want To Delete This Customer (y or n): "<<endl;<br />
cin>>YorN;<br />
<br />
if((YorN=='y')||(YorN=='Y'))
{<br />
for(i=FindCustomerList; i<NoOfCustomers; i++)
{
strcpy(CDBase[i].Name, CDBase[i+1].Name);<br />
strcpy(CDBase[i].Address, CDBase[i+1].Address);
strcpy(CDBase[i].Phone, CDBase[i+1].Phone);<br />
strcpy(CDBase[i].SocialSecurityNum, CDBase[i+1].SocialSecurityNum);<br />
}<br />
NoOfCustomers=NoOfCustomers-1;<br />
if (NoOfCustomers < 0)<br />
{<br />
NoOfCustomers=0;
}<br />
cout<<"*CUSTOMER DELETED*"<<endl;<br />
}<br />
else <br />
cout<<"*ACTION CANCELED*"<<endl;<br />
}<br />
<br />
<br />
<br />
void ModifyPlant ()<br />
{<br />
char YorN;<br />
<br />
cout<<"\n**MODIFY PLANT'S INFORMATION**\n";<br />
cout<<"______________________________\n";<br />
FindPlant ();
<br />
cout<<"PLANT #: "<<FindPlantList+1<<endl;<br />
cout<<"FAMILY & NAME: "<<PDBase[FindPlantList].PlantFamily_Name<<endl;<br />
cout<<"TYPE : "<<PDBase[FindPlantList].Type<<endl;
cout<<"COLOUR : "<<PDBase[FindPlantList].Colour<<endl;
cout<<"SIZE : "<<PDBase[FindPlantList].Size<<endl;<br />
cout<<"IN STOCK : "<<PDBase[FindPlantList].NumOfThisInStock<<endl;<br />
cout<<"GARDEN PLANT : "<<PDBase[FindPlantList].ItIsGarden<<endl;<br />
cout<<"PRICE : "<<PDBase[FindPlantList].Price<<endl;<br />
cout<<endl<<endl;<br />
<br />
cout<<"Now Enter The New Information For This Plant\n "<br />
<<"(You Can't Change Plant's Family & Name)\n";<br />
cout<<"_____________________________________________\n";<br />
<br />
<br />
cout<<"Are You Sure You Want To Modify This Plant (y or n): "<<endl;<br />
cin>>YorN;<br />
if((YorN=='y')||(YorN=='Y'))<br />
{<br />
cout<<"**MODIFICATIONS**: "<<endl;<br />
cout<<"TYPE: "<<endl;<br />
gets(PDBase[FindPlantList].Type);
cout<<"COLOUR: "<<endl;<br />
gets(PDBase[FindPlantList].Colour);<br />
cout<<"SIZE: "<<endl;<br />
gets(PDBase[FindPlantList].Size);<br />
cout<<"HOW MANY ARE IN STOCK: "<<endl;<br />
cin>>PDBase[FindPlantList].NumOfThisInStock;<br />
cout<<"IT IS A GARDEN PLANT: "<<endl;<br />
gets(PDBase[FindPlantList].ItIsGarden);<br />
cout<<"PRICE: "<<endl;<br />
cin>>PDBase[FindPlantList].Price;<br />
<br />
cout<<"\n\n**You Have Modify "<<PDBase[FindPlantList].PlantFamily_Name<<" Information**\n";<br />
}<br />
else<br />
cout<<"*ACTION CANCELED*"<<endl;<br />
}<br />
<br />
void FindPlant ()<br />
{<br />
int i;<br />
int Finder=0;
char PFamily_Name[40];
int tmp1=0;<br />
<br />
<br />
cout<<"Please Enter Plant's Family & Name (ie.Family(space)Name): "<<endl;<br />
gets(PFamily_Name);<br />
<br />
<br />
for(i=0; i<NoOfPlants; i++)
{<br />
tmp1=strcmp(PDBase[i].PlantFamily_Name, PFamily_Name);
<br />
if (tmp1 != 1)<br />
{
Finder++;
}<br />
}<br />
<br />
FindPlantList=Finder-1;<br />
<br />
<br />
}<br />
<br />
<br />
void ModifyCustomer ()<br />
{<br />
char YorN;<br />
<br />
cout<<"\n**MODIFY CUSTOMER'S INFORMATION**\n";<br />
cout<<"____________________________________\n\n";<br />
<br />
FindCustomer();
cout<<"CUSTOMER #: "<<FindCustomerList+1<<endl;<br />
cout<<"NAME : "<<CDBase[FindCustomerList].Name<<endl;<br />
cout<<"ADDRESS : "<<CDBase[FindCustomerList].Address<<endl;<br />
cout<<"PHONE NUMBER : "<<CDBase[FindCustomerList].Phone<<endl;<br />
cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
cout<<endl<<endl;<br />
cout<<"\nNow Enter The New Information For This Customer\n "<br />
<<"(You Can't Change Name & Social Security Number)\n";<br />
cout<<"_________________________________________________\n";<br />
<br />
cout<<"Are You Sure You Want To Modify This Customer (y or n): "<<endl;<br />
cin>>YorN;<br />
<br />
if((YorN=='y')||(YorN=='Y'))<br />
{
cout<<"**MODIFICATIONS**: "<<endl;<br />
cout<<"ADDRESS: "<<endl;<br />
gets(CDBase[FindCustomerList].Address);<br />
cout<<"PHONE NUMBER: "<<endl;<br />
gets(CDBase[FindCustomerList].Phone);<br />
<br />
cout<<"\n\n**You Have Modify "<<CDBase[FindCustomerList].Name<<" Information**\n";<br />
}<br />
else<br />
cout<<"*ACTION CANCELED*"<<endl;<br />
<br />
}<br />
<br />
void FindCustomer()<br />
{<br />
int i;<br />
int Finder=0;
char Social[15];
int tmp=0;<br />
<br />
cout<<"Enter Customer Social Number: "<<endl;<br />
gets(Social);<br />
<br />
for(i=0; i<NoOfCustomers; i++)<br />
{<br />
tmp=strcmp(CDBase[i].SocialSecurityNum, Social);
<br />
if (tmp != 1)
{<br />
Finder++;<br />
}<br />
}<br />
<br />
FindCustomerList=Finder-1;<br />
<br />
<br />
}<br />
<br />
<br />
<br />
void HowManyCustomers ()<br />
{<br />
<br />
cout<<endl; <br />
DisplayCustomers ();
<br />
cout<<"\nThere Are "<<NoOfCustomers<<" Customers In The Database."<<endl;<br />
counterC=MaxNoOfCustomers-NoOfCustomers;<br />
cout<<"You Can Still Insert "<<counterC<<" Other Customers In The Database."<<endl;<br />
<br />
}<br />
<br />
<br />
void DisplayCustomers ()<br />
{<br />
int i;<br />
<br />
for(i=0; i<NoOfCustomers; i++)
{<br />
cout<<endl;
cout<<"CUSTOMER #: "<<i+1<<endl;<br />
cout<<"NAME : "<<CDBase[i].Name<<endl;<br />
cout<<"ADDRESS : "<<CDBase[i].Address<<endl;<br />
cout<<"PHONE NUMBER : "<<CDBase[i].Phone<<endl;<br />
cout<<"SECURITY NUMBER : "<<CDBase[i].SocialSecurityNum<<endl;<br />
cout<<"____________________________________\n"<<endl;<br />
}<br />
<br />
}<br />
<br />
void DisplayPlants ()<br />
{<br />
int i;<br />
<br />
for(i=0; i<NoOfPlants; i++)
{<br />
cout<<endl;<br />
cout<<"PLANT #: "<<i+1<<endl;
cout<<"FAMILY & NAME : "<<PDBase[i].PlantFamily_Name<<endl;<br />
cout<<"TYPE : "<<PDBase[i].Type<<endl;<br />
cout<<"COLOUR : "<<PDBase[i].Colour<<endl;<br />
cout<<"SIZE : "<<PDBase[i].Size<<endl;<br />
cout<<"IN STOCK : "<<PDBase[i].NumOfThisInStock<<endl;<br />
cout<<"GARDEN PLANT : "<<PDBase[i].ItIsGarden<<endl;<br />
cout<<"PRICE : "<<PDBase[i].Price<<endl;<br />
cout<<"____________________________________\n"<<endl;<br />
<br />
}<br />
}<br />
<br />
void HowManyPlants ()<br />
{<br />
<br />
cout<<endl; <br />
DisplayPlants ();
<br />
cout<<"\nThere Are "<<NoOfPlants<<" Different Plants In Stock In The Database."<<endl;<br />
counterP=MaxNoOfPlants-NoOfPlants;<br />
cout<<"You Can Still Insert "<<counterP<<" Plants In The Database."<<endl;<br />
<br />
}<br />
<br />
<br />
void ReadNewCustomer ()<br />
{<br />
<br />
int i=0,j=0;<br />
char tempCName[30];
char tempCAddress[80];<br />
char tempCPhone[10];<br />
char tempCSecurity[15];<br />
<br />
int tmp, tmp1;<br />
<br />
cout<<"\nCUSTOMER #: "<<NoOfCustomers+1<<endl;
cout<<"NAME: "<<endl;<br />
gets(CDBase[NoOfCustomers].Name);<br />
cout<<"ADDRESS: "<<endl;<br />
gets(CDBase[NoOfCustomers].Address);<br />
cout<<"PHONE NUMBER: "<<endl;<br />
gets(CDBase[NoOfCustomers].Phone);<br />
cout<<"ENTER SOCIAL SECURITY NUMBER:\n " <br />
<<"First Enter The First Letter Of \n"<br />
<<"His/Her First & Last Name & Then The Number\n"<br />
<<"(eg. If Name Is 'Nicholas Try' Write:EC22332): "<<endl;
gets(CDBase[NoOfCustomers].SocialSecurityNum);<br />
<br />
NoOfCustomers++;
<br />
for(i=0; i<NoOfCustomers; i++)
{<br />
for(j=0; j<NoOfCustomers; j++)<br />
{<br />
tmp=strcmp(CDBase[i].Name, CDBase[j].Name);<br />
tmp1=strcmp(CDBase[i].SocialSecurityNum, CDBase[j].SocialSecurityNum);<br />
<br />
if ((tmp<0)&&(tmp1<0))
{<br />
strcpy(tempCName, CDBase[i].Name);
strcpy(tempCAddress, CDBase[i].Address);<br />
strcpy(tempCPhone, CDBase[i].Phone);<br />
strcpy(tempCSecurity, CDBase[i].SocialSecurityNum);<br />
<br />
strcpy(CDBase[i].Name, CDBase[j].Name);<br />
strcpy(CDBase[i].Address, CDBase[j].Address);<br />
strcpy(CDBase[i].Phone, CDBase[j].Phone);<br />
strcpy(CDBase[i].SocialSecurityNum, CDBase[j].SocialSecurityNum);<br />
<br />
strcpy(CDBase[j].Name, tempCName);<br />
strcpy(CDBase[j].Address, tempCAddress);<br />
strcpy(CDBase[j].Phone, tempCPhone);<br />
strcpy(CDBase[j].SocialSecurityNum, tempCSecurity);<br />
}<br />
}<br />
}<br />
<br />
}<br />
<br />
<br />
void ReadNewPlant ()<br />
{<br />
int i=0,j=0;<br />
<br />
<br />
char tempPFamily_Name[30];
char tempPType[8];<br />
char tempPColour[10];<br />
char tempPSize[8];<br />
int tempPInStock;<br />
char tempPIsAGarden[3];<br />
float tempPPrice=0.0;<br />
int tmp1;<br />
<br />
<br />
cout<<"\nPLANT #: "<<NoOfPlants+1<<endl;<br />
cout<<"ENTER PLANT'S FAMILY & NAME (ie. Family(space)Name): "<<endl;<br />
gets(PDBase[NoOfPlants].PlantFamily_Name);<br />
cout<<"ENTER ITS TYPE(Flower Or Tree): "<<endl;<br />
gets(PDBase[NoOfPlants].Type);<br />
cout<<"ENTER THE COLOUR OF ITS BLOSSOM: "<<endl;<br />
gets(PDBase[NoOfPlants].Colour);<br />
cout<<"PLEASE ENTER ITS SIZE(Small, Medium, Large): "<<endl;<br />
gets(PDBase[NoOfPlants].Size);<br />
cout<<"HOW MANY OF THIS PLANT ARE IN STOCK: "<<endl;<br />
cin>>PDBase[NoOfPlants].NumOfThisInStock; <br />
cout<<"IT IS A GARDEN FLOWER ? (Yes Or No): "<<endl;<br />
gets(PDBase[NoOfPlants].ItIsGarden);<br />
cout<<"ENTER ITS PRICE: "<<endl;<br />
cin>>PDBase[NoOfPlants].Price; <br />
cout<<endl;<br />
<br />
NoOfPlants++;
<br />
<br />
for(i=0; i<NoOfPlants; i++)
{<br />
for(j=0; j<NoOfPlants; j++)
{ <br />
tmp1=strcmp(PDBase[i].PlantFamily_Name, PDBase[j].PlantFamily_Name);<br />
if (tmp1<0)<br />
{<br />
strcpy(tempPFamily_Name, PDBase[i].PlantFamily_Name);<br />
strcpy(tempPType, PDBase[i].Type);<br />
strcpy(tempPColour, PDBase[i].Colour);<br />
strcpy(tempPSize, PDBase[i].Size);<br />
tempPInStock=PDBase[i].NumOfThisInStock;<br />
strcpy(tempPIsAGarden, PDBase[i].ItIsGarden);<br />
tempPPrice=PDBase[i].Price;<br />
<br />
strcpy(PDBase[i].PlantFamily_Name, PDBase[j].PlantFamily_Name);<br />
strcpy(PDBase[i].Type, PDBase[j].Type);<br />
strcpy(PDBase[i].Colour, PDBase[j].Colour);<br />
strcpy(PDBase[i].Size, PDBase[j].Size);<br />
PDBase[i].NumOfThisInStock=PDBase[j].NumOfThisInStock;<br />
strcpy(PDBase[i].ItIsGarden, PDBase[j].ItIsGarden);<br />
PDBase[i].Price=PDBase[j].Price;<br />
<br />
strcpy(PDBase[j].PlantFamily_Name, tempPFamily_Name);<br />
strcpy(PDBase[j].Type, tempPType);<br />
strcpy(PDBase[j].Colour, tempPColour);<br />
strcpy(PDBase[j].Size, tempPSize);<br />
PDBase[j].NumOfThisInStock=tempPInStock;<br />
strcpy(PDBase[j].ItIsGarden, tempPIsAGarden);<br />
PDBase[j].Price=tempPPrice;<br />
<br />
<br />
}<br />
}<br />
}<br />
<br />
}<br />
<br />
void ShowMenu ()<br />
{<br />
cout<<"________________________________________________________________________________"<<endl;<br />
cout<<"\t\t\t NURSERY GARDEN COMPANY\n";<br />
cout<<"\t\t ********************************\n";<br />
cout<<"\t\t\t\tMAIN MENU\n\n";<br />
cout<<" 0.EXIT\n";<br />
cout<<" 1.Read The Information For A New Plant.\n";<br />
cout<<" 2.Read The Information For A New Customer. \n";<br />
cout<<" 3.Show How Many Plants Are In The List - How Many Can Still Be Inseret.\n";<br />
cout<<" 4.Show How Many Customers Are In The List - How Many Can Still Be Insert. \n";<br />
cout<<" 5.Delete A Plant Given Its Family And Name.\n";<br />
cout<<" 6.Delete A Customer Given His/Her Social Security Number.\n";<br />
cout<<" 7.Insert An Order.\n";<br />
cout<<" 8.Modify The Data For A Particular Plant.\n";<br />
cout<<" 9.Modify The Data For A Particular Customer.\n";<br />
cout<<"10.Modify An Order.\n";<br />
cout<<"11.View An Order.\n";<br />
cout<<"12.View Reports.\n";<br />
<br />
cout<<"________________________________________________________________________________\n";<br />
cout<<endl;<br />
}<br />
<br />
void ChooseMenu (int menu)<br />
{<br />
switch (menu)<br />
{<br />
case 0:<br />
cout<<"\nEXIT............. BYE BYE!!!\n\n";<br />
break;<br />
case 1:<br />
ReadNewPlant ();<br />
break;<br />
case 2:<br />
ReadNewCustomer ();<br />
break;<br />
case 3:<br />
HowManyPlants ();<br />
break;<br />
<br />
case 4:<br />
HowManyCustomers ();<br />
break;<br />
<br />
case 5:<br />
DeleteP ();<br />
break;<br />
<br />
case 6:<br />
DeleteC ();<br />
break;<br />
<br />
case 7:<br />
InsertOrder ();<br />
break;<br />
case 8:<br />
ModifyPlant ();<br />
break;<br />
case 9:<br />
ModifyCustomer ();<br />
break;<br />
case 10:<br />
ModifyOrder ();<br />
break;<br />
<br />
case 11:<br />
ViewOrder ();<br />
break;<br />
<br />
case 12:<br />
ReportChoose ();<br />
break;<br />
<br />
default:<br />
{<br />
cout<<"INVALID NUMBER"<<endl;<br />
<br />
cout<<"Insert one of the above: ";<br />
cin>>menu;<br />
<br />
<br />
}<br />
}<br />
}<br />
<br />
void main ()<br />
{<br />
<br />
do<br />
{<br />
ShowMenu ();
cout<<"Choose an action: ";<br />
cin>>menu;<br />
ChooseMenu (menu);<br />
}while(menu != 0);<br />
}<br />
<br />
<br />
<br />
|