|
Hello all,
I currently have an application with a class derived from CDateTimeCtrl that is being used as a picker on a dialog. Now I would like to display week numbers in the CDateTimeCtrl that pops up when you click it. I have an override on OnDropdown and I can fetch the CDateTimeCtrl using GetMonthCalCtrl. However, I can't figure out how to set the week numbers.
As far as I can see, the week numbers must be set with MCS_WEEKNUMBERS in CDateTimeCtrl::Create. I think CDateTimeCtrl::Create is already called when I call GetMonthCalCtrl in OnDropdown... Is there no other way to set the MCS_WEEKNUMBERS? Or how else should I do this?
Thanks,
- Fahr
|
|
|
|
|
In the DTN_DROPDOWN handler, you simply need:
CMonthCalCtrl *pCtrl = m_dateCtrl.GetMonthCalCtrl();
LONG lStyle = GetWindowLong(pCtrl->GetSafeHwnd(), GWL_STYLE);
SetWindowLong(pCtrl->GetSafeHwnd(), GWL_STYLE, lStyle | MCS_WEEKNUMBERS);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks, that worked!
|
|
|
|
|
there is a popular example of atlopengl_demo that can be downloaded in the page http://www.codeproject.com/atl/atlopengl.asp.
It is a opengl control created in VC, but when I use it in vb ,it can not work, why?
If I want to use it well in VB,how can I do?
thank you very much!
good luck
|
|
|
|
|
|
I'm not sure I should even dignify this post with a response. Does Dr. Artusi know that you are offering to pay others to do your assignments?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Please send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk
|
|
|
|
|
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 />
|
|
|
|
|
Please send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk
|
|
|
|
|
lease send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk
|
|
|
|
|
lease send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk
|
|
|
|
|
lease send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk
|
|
|
|
|
lease send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk
|
|
|
|
|
lease send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk ssss
|
|
|
|
|
lease send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk ssssdsadasdsa
|
|
|
|
|
Please send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk
|
|
|
|
|
Please send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk
|
|
|
|
|
Please send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][pkk we
|
|
|
|
|
|
Sure no problem at all. Is $10000US an hour ok? If this is a problem for you dont worry I will contact your teacher artusi.a @ intercollege.ac.cy and explain that you cant afford to do your homework. Used, unmarked and nonsequential banks notes will be fine thanks
|
|
|
|
|
Please send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.
|
|
|
|
|
|
Please send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][p
|
|
|
|
|
Please send me the solution for this....
http://www.facultyintranet.intercol.edu/onlinecourse/CourseFiles/COMP-255_1124/Project-Sp05.doc
i have it finished... could anybody check it for me? email me to send you my solution.][][p
|
|
|
|
|
//Read Plants & Customers, Create Orders, Modify Information, Provide Reports
#include <iostream.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
const int MaxNoOfPlants=100; //Maximum Number Of Plants To Be In The List
const int MaxNoOfCustomers=20; //Maximum Number Of Customers To Be In The list
int menu=0; //Menu Choice
int NoOfPlants=0; //Counts The Number Of Plants Are In The Database
int NoOfCustomers=0; //Counts The Number Of Customers Are In The Database
int counterP=0; //Counts How Many Plants Can Still Be Insert In The List
int counterC=0; //Counts How Many Customers Can Still Be Insert In The List
int FindCustomerList=0; //The Place In The Array That A Plant Is
int FindPlantList=0; //The Place In The Array That A Customer Is
class Order1 { //Part Of class Customer
public: //Keep Information About The Order That Each Customer Make
char Order[40]; //Family & Name Of The Ordered Plant
int Quantity; //The Ordered Quantity For This Plant
float Invoice; //The Cost Of This Plant (Price * Quantity)
};
class Plant { //Keep Information For Each Plant In Thr List
public:
char PlantFamily_Name[40]; //Family & Name Of The Plant
char Type[8]; //Flower or Tree
char Colour[10]; //Colour Of Plant's Blossom
char Size[8]; //small, medium, large
int NumOfThisInStock; //How Many Of This Plant
char ItIsGarden[3]; //The Answer If Plant Is A Garder Flower
float Price; //It's Price
int QSell; //Keep The Number Quantity Sell Of Each Plant
char QName[40]; //In Order To Find The 5 Top Selling Plants
//Use This Instead Of "char PlantFamily_Name[40];"
//So We Do Not Lose The Alphabetical Order
};
class Customer { //Keep Information Of The Customer
public:
char Name[30]; //Customer's Name
char Address[80]; //His/Her Address
char Phone[10]; //Phone Number
char SocialSecurityNum[15]; //His/Her Sicial Security Number
int HowM; //Keep The Number Of Different Plant He/She Ordered
float TotalInvoice; //The Total Cost For Each Order
float TurnOver; //The Turnover Of All Orders
Order1 Or[10];
};
Plant PDBase[MaxNoOfPlants];
Customer CDBase[MaxNoOfCustomers];
//Displays The Main Menu
void ShowMenu ();
//Asks For A Choice
void ChooseMenu (int menu);
//The User Enter Information For A New Plant.
//The Plant Are Sorted According To Alphabetical Order.
void ReadNewPlant ();
//The User Enter Information For A New Customer.
//The Customers Are Sorted According To Alphabetical Order.
void ReadNewCustomer ();
//Displays The Plants Are In The List In Alphabetical Order.
//Counts How Many Plants Are In The List And How Many Can Still Be Insert
void HowManyPlants ();
//Display Plants
void DisplayPlants ();
//Display Customers
void DisplayCustomers ();
//Displays The Customers Are In The List In Alphabetical Order.
//Counts How Many Customers Are In The List And How Many Can Still Be Insert
void HowManyCustomers ();
//Asks For Customers Social Security Number
//Find The Place In The Array That This Customer Is.
void FindCustomer();
//Find The Customer With The Function "FindCustomer();".
//And Madify Some Of His/Her Information
void ModifyCustomer ();
//Asks For Plants Family And Name.
//Find The Place In The Array That This Plant Is.
void FindPlant ();
//Find The Plant With The Function "FindPlant ();".
//And Madify Some Of Its Information
void ModifyPlant ();
//Delete Customer By Giving His/Her Social Security Number.
void DeleteC ();
//Delete Plant Giving Its Family And Name
void DeleteP ();
//Find The Customer That Make This Order....use "FindCustomer();".
//And Enter How Many Different Plants He/She Is Going To Order.
void InsertOrder ();
//Make This Order. Enter The Plants And The Quantity For Each Different Plants
void MakeOrder ();
//Show Order That Made By A Customer
void ShowOrder ();
//Make Changes In The Last Order That Made By A Customer, Or Make A New One
void ModifyOrder ();
//View An Order
void ViewOrder ();
//Report Menu. Make A Choice
void ReportChoose ();
//Find The Customer With The Bigger Turnover
void FindCustBiggerTurnover ();
//Find The Plants Whose Price Is Between x and y pounds
void FindPlantWhosePriceIs ();
//Find And Display Out The Top 5 Selling Plants
void TopSell ();
//Find The Top 5 Selling Plants
void TopSell5 ();
//Displays The Top 5 Selling Plants
void TopSell5Display ();
//Find And Displays Top 1 Selling Plant
void TopSell1 ();
//Find And Displays Top 1 Selling Plant
//Compare Using Quantities. Sort The Plants According The Value Of The Quantities
void TopSell1 ()
{
int i,j;
char tempName[40]; //Use To Swap The Family & Name Of Plant
int tempQSell; //Use To Swap The Qauntity Sell Of Each Plant
for(i=0; i<noofplants; i++)="" loop:="" equal="" time="" each="" is="" the="" number="" of="" plants="" are="" in="" list
{
="" for(j="0;" j<noofplants;="" j++)="" list
="" {
="" if="" (pdbase[i].qsell="">PDBase[j].QSell) //Compare The Quantities Sold For Each Plants
{
strcpy(tempName, PDBase[i].QName);
tempQSell=PDBase[i].QSell;
strcpy(PDBase[i].QName, PDBase[j].QName);
PDBase[i].QSell=PDBase[j].QSell;
strcpy(PDBase[j].QName, tempName);
PDBase[j].QSell=tempQSell;
}
}
}
//Displays Out Only The Top Selling. That Plant That Was Sold More Than The Others
cout<<"The Top Selling Plant Is: \n";
for(i=0; i<1; i++)
{
cout<<"\nPLANT'S NAME: "<<pdbase[i].qname<<endl;
cout<<"sell="" quantity="" :="" "<<pdbase[i].qsell<<endl;
="" cout<<"______________________________\n";
="" }
}
="" this="" function="" is="" called="" from="" "topsell5="" ();".
="" display="" the="" top="" 5="" selling="" plants
void="" topsell5display="" ()
{
="" int="" i;
="" for(i="0;" i<5;="" i++)
="" {
="" cout<<"plant="" #:="" "<<i+1<<endl;
="" cout<<"plant's="" name="" "<<pdbase[i].qname<<endl;
="" cout<<"______________________________\n";
="" }
}
="" sort="" plants="" accorting="" quantities="" sold
="" call="" "topsell5display="" ();"
void="" topsell5="" ()
{=""
="" i,j;
="" char="" tempname[40];
="" tempqsell;
for(i="0;" i<noofplants;="" i++)
{
="" for(j="0;" j<noofplants;="" j++)
="" {
="" if="" (pdbase[i].qsell="">PDBase[j].QSell) //Compare Quantities Sold For Each Plant
{
strcpy(tempName, PDBase[i].QName);
tempQSell=PDBase[i].QSell;
strcpy(PDBase[i].QName, PDBase[j].QName);
PDBase[i].QSell=PDBase[j].QSell;
strcpy(PDBase[j].QName, tempName);
PDBase[j].QSell=tempQSell;
}
}
}
cout<<"The 5 Top Selling Plants Are: \n";
TopSell5Display (); //Call This Fuction To Displays The Top 5 Selling
}
//Copy The Name Of Plants In An Other Array
//This Is Beacause The Plants Are Going To Sort Accorting There Quantities Sold
//So The Alphabetical Order Stay Whithout Any Changes
void TopSell ()
{
int i;
for(i=0; i<noofplants; i++)
="" {
="" strcpy(pdbase[i].qname,="" pdbase[i].plantfamily_name);
="" }
topsell5="" ();
}
="" find="" and="" displays="" out="" the="" plants="" whose="" price="" is="" between="" x="" y="" pounds
void="" findplantwhosepriceis="" ()
{
="" int="" i;
float="" price1;="" from="" price
float="" price2;="" up="" to="" price
cout<<"please="" enter="" what="" price:="" \n";
cin="">>Price1;
cout<<"And Up To What Price: \n";
cin>>Price2;
cout<<"\n**PLANTS WHOSE PRICE IS BETWEEN "<<price1<< "="" &="" "<<price2<<"**\n";
="" for(i="0;" i<noofplants;="" i++)
="" {=""
="" if((pdbase[i].price="">=Price1)&&(PDBase[i].Price<=Price2)) //Price Between x And y
{
cout<<"\nPLANT #: "<<i+1<<endl;
cout<<"family="" &="" name:="" "<<pdbase[i].plantfamily_name<<endl;="" displays="" out="" the="" plants
="" cout<<"type="" :="" "<<pdbase[i].type<<endl;="" with="" there="" informations
="" cout<<"colour="" "<<pdbase[i].colour<<endl;
="" cout<<"size="" "<<pdbase[i].size<<endl;
="" cout<<"in="" stock="" "<<pdbase[i].numofthisinstock<<endl;
="" cout<<"garden="" plant="" "<<pdbase[i].itisgarden<<endl;
="" cout<<"price="" "<<pdbase[i].price<<endl;
="" cout<<"____________________________\n\n";
="" }
="" }
}
="" find="" customer="" bigger="" turnover
void="" findcustbiggerturnover="" ()
{
="" int="" i;
="" count="0;
" float="" fbig="0;
" i="1;
" while(i<noofcustomers)
="" {
="" if(cdbase[i].turnover="">FBig) //Compare The Turnovers For Each Customer
{ //If Is Bigger...
FBig=CDBase[i].TurnOver;
count=i; //Is Equal To Place Of The Customer, With The Biggest Turnover, In The Array
}
i++;
}
cout<<"\nCustomer With The Bigger Turnover: \n"; //Display Out The Customer
cout<<"Customer #: "<<count+1<<endl; with="" the="" turnover
="" cout<<"name="" :="" "<<cdbase[count].name<<endl;
="" cout<<"turnover="" :"<<cdbase[count].turnover<<endl<<endl;
}
="" report="" menu.="" make="" a="" choice
void="" reportchoose="" ()
{
="" int="" menur;
="" cout<<"\n\n**report="" menu**\n";
="" cout<<"____________________\n";
="" cout<<"\n1.information="" of="" particular="" plant\n";
="" cout<<"2.information="" customer\n";
="" cout<<"3.information="" on="" top="" 5="" selling="" plants\n";
="" cout<<"4.information="" cout<<"5.information="" customer="" biggest="" turnover\n";
="" cout<<"6.information="" plants="" whose="" price="" is="" between...\n";
="" cout<<"7.return="" to="" main="" menu\n";
="" cout<<"\nplease="" your="" choice:="" "<<endl;
="" cin="">>menuR;
switch (menuR) //Choice
{
case 1: //Displays Out Information On A Particular Plant
{
FindPlant ();
cout<<"\n\nPLANT #: "<<findplantlist+1<<endl;
cout<<"family="" &="" name:="" "<<pdbase[findplantlist].plantfamily_name<<endl;
="" 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;
="" cout<<"price="" "<<pdbase[findplantlist].price<<endl;
="" cout<<endl<<endl;
="" break;
="" }
="" case="" 2:="" displays="" out="" the="" information="" of="" a="" particular="" customer
="" {
="" findcustomer();
="" cout<<"\n\ncustomer="" #:="" "<<findcustomerlist+1<<endl;
="" cout<<"name="" "<<cdbase[findcustomerlist].name<<endl;
="" cout<<"address="" "<<cdbase[findcustomerlist].address<<endl;
="" cout<<"phone="" number="" "<<cdbase[findcustomerlist].phone<<endl;
="" cout<<"social="" sec="" num:="" "<<cdbase[findcustomerlist].socialsecuritynum<<endl;
="" 3:="" finds="" and="" top="" 5="" selling="" plants
="" topsell="" ();
="" 4:="" plant
="" topsell1="" break;
="" }
="" 5:="" on="" customer="" with="" biggest="" turnover
="" findcustbiggerturnover="" 6:="" plants="" whose="" price="" is="" between="" two="" prices
="" findplantwhosepriceis="" }
="" 7:="" return="" to="" main="" menu
="" {
="" showmenu="" cout<<"choose="" an="" action:="" ";
="" cin="">>menu;
ChooseMenu(menu);
break;
}
default: //Show Again The Report's Menu
{
ReportChoose ();
break;
}
}
}
//View An Order Of A Particular Customer
void ViewOrder ()
{
cout<<"**VIEW ORDER**\n";
cout<<"Find The Customer How Make That Order\n";
FindCustomer(); //Find The Customer By Giving His/Her Social Number
cout<<"\n*SELECTED CUSTOMER*\n";
cout<<"_______________________\n";
cout<<"CUSTOMER #: "<<findcustomerlist+1<<endl; display="" the="" information="" of="" this="" customer
="" cout<<"name="" :="" "<<cdbase[findcustomerlist].name<<endl;
="" cout<<"address="" "<<cdbase[findcustomerlist].address<<endl;
="" cout<<"phone="" number="" "<<cdbase[findcustomerlist].phone<<endl;
="" cout<<"social="" sec="" num:="" "<<cdbase[findcustomerlist].socialsecuritynum<<endl;
="" cout<<endl<<endl;
cout<<"this="" is="" his="" her="" order\n";
cout<<"_________________\n";
showorder="" ();="" order
}
="" with="" function="" user="" can="" motify="" orders=""
void="" modifyorder="" ()
{
="" char="" q;
="" choice1;
int="" i;
="" float="" inv="0.0;" invoice="" for="" each="" ordered="" plant
int="" plus="0;" plants="" to="" be="" insert="" in="" order
float="" tempinvoice="0.0;" keep="" value="" old="" order
int="" tempquantity="0;" quantity="" ordered
cout<<"**modify="" order**\n";
cout<<"find="" customer="" how="" make="" that="" order\n";
findcustomer();="" find="" social="" security="" number
cout<<"\n*selected="" customer*\n";
="" cout<<"_______________________\n";=""
="" cout<<"customer="" #:="" "<<findcustomerlist+1<<endl;
="" displays="" customer's="" order
cout<<"\nare="" you="" sure="" want="" modify="" order?="" (y="" or="" n):\n";="" question="" 1
cin="">>q; //Ask User If He/She Is Sure To Modify
if((q=='y')||(q=='Y')) //If Answer Is Yes
{
//Enter 1 If Want To Change Only The Quantity Of The Ordered Plants
cout<<"If You Want To Change Only The Quantity Of The Plants Of The Last Order Enter 1.\n";
//Enter 2 If Want To Insert More Differents Plants In The Order
cout<<"If You Want To Insert More Different Plants In Your Order Enter 2.\n";
//Enter 3 If Want To Make A New Order
cout<<"If You Want To Make A New Order For That Customer Enter 3.\n";
cin>>choice1; //Question 2
if(choice1=='1') //If Answer Is 1
{ tempInvoice=CDBase[FindCustomerList].TotalInvoice;
cout<<"*Change The Quantity*\n";
cout<<"\nCUSTOMER'S NAME: "<<cdbase[findcustomerlist].name<<endl;
for(i="0;" i<cdbase[findcustomerlist].howm;="" i++)
="" {
="" cout<<"plant="" #="" :="" "<<i+1<<endl;
="" cout<<"name:="" "<<cdbase[findcustomerlist].or[i].order<<endl;
="" cout<<"in="" order="" to="" continue\n";
="" findplant="" ();="" enter="" again="" family="" &="" name="" of="" this="" plant=""
="" tempquantity="PDBase[FindPlantList].QSell;" keep="" the="" old="" value="" quantity="" ordered
="" cout<<"new="" quantity:="" "<<endl;="" asks="" for="" new="" quantity
="" cin="">>CDBase[FindCustomerList].Or[i].Quantity;
if(PDBase[FindPlantList].NumOfThisInStock==0) //If There Are No Any Plants Of This Type In The Database
{ //A Message Displays That
cout<<"There Are No Such Plants In Stock\n";
}
//If The New Quantity Is Bigger Than The Quantity Of This Plant In Stock
if(CDBase[FindCustomerList].Or[i].Quantity>PDBase[FindPlantList].NumOfThisInStock)
{
//The Order Stops
cout<<"Order Stoped\n";
//Show The Number Of This Plant In Stock
cout<<"Available Quantity For This Is: "<<pdbase[findplantlist].numofthisinstock<<endl;
cout<<"\nplease="" change="" quantity.="" new="" quantity:="" \n";="" ask="" for="" a="" quantity
="" cin="">>CDBase[FindCustomerList].Or[i].Quantity;
}
//The Number Of This Plant In Stock Is Updated.
PDBase[FindPlantList].NumOfThisInStock=PDBase[FindPlantList].NumOfThisInStock-CDBase[FindCustomerList].Or[i].Quantity;
//Calculate The Invoice For Each Different Plant
CDBase[FindCustomerList].Or[i].Invoice=CDBase[FindCustomerList].Or[i].Quantity*PDBase[FindPlantList].Price;
//Total Invoice
inv=inv+CDBase[FindCustomerList].Or[i].Invoice;
CDBase[FindCustomerList].TotalInvoice=inv;
//Quantity Sold For Each Plant Is Updated
PDBase[FindPlantList].QSell=PDBase[FindPlantList].QSell+CDBase[FindCustomerList].Or[i].Quantity-tempQuantity;
//Total Turnover
CDBase[FindCustomerList].TurnOver=CDBase[FindCustomerList].TurnOver+CDBase[FindCustomerList].TotalInvoice-tempInvoice;
}
}
//Question 2
if(choice1=='2') //If Answer Is 2...Insert More Different Plants In The Order
{
cout<<"*Insert More*\n";
cout<<"\nCUSTOMER'S NAME: "<<cdbase[findcustomerlist].name<<endl;
ask="" the="" number="" of="" different="" plants="" to="" insert
="" cout<<"\nhow="" many="" do="" you="" want="" insert="" your="" order?:="" \n";
="" cin="">>plus;
for(i=CDBase[FindCustomerList].HowM; i<cdbase[findcustomerlist].howm+plus; i++)
="" {
=""
="" cout<<"plant="" #:="" "<<i+1<<endl;="" insert="" the="" first="" new="" plant
="" findplant="" ();="" find="" that="" plant="" cout<<"selected="" plant:="" "<<pdbase[findplantlist].plantfamily_name="" <<endl;
="" cout<<"quantity:="" "<<endl;="" quantity="" customer="" want
="" cin="">>CDBase[FindCustomerList].Or[i].Quantity;
if(PDBase[FindPlantList].NumOfThisInStock<=0) //If The Quantity Of This Plant In Stock Is Zero
{
cout<<"There Are No Such Plants In Stock\n"; //Asks User To Change The Order By Selecting An Other Plant
cout<<"Please Change Your Order.\n";
cout<<"PLANT #: "<<i+1<<endl;
findplant="" ();="" find="" new="" plant
="" cout<<"selected="" plant:="" "<<pdbase[findplantlist].plantfamily_name="" <<endl;
="" cout<<"quantity:="" \n";="" quantity
="" cin="">>CDBase[FindCustomerList].Or[i].Quantity;
}
//If The New Quantity Is Bigger Than The Quantity Of This Plant In Stock
if(CDBase[FindCustomerList].Or[i].Quantity>PDBase[FindPlantList].NumOfThisInStock)
{
//The Order Stop And Show How MAny Plant Of This Type Are Available
cout<<"Order Stoped\n";
cout<<"Available Quantity For This Is: "<<pdbase[findplantlist].numofthisinstock<<endl;
ask="" user="" for="" new="" quantity
="" cout<<"\nplease="" change="" quantity.="" quantity:="" \n";
="" cin="">>CDBase[FindCustomerList].Or[i].Quantity;
}
//Take The Order...Name Of Ordered Plant
strcpy(CDBase[FindCustomerList].Or[i].Order, PDBase[FindPlantList].PlantFamily_Name);
//Stock Number Updated
PDBase[FindPlantList].NumOfThisInStock=PDBase[FindPlantList].NumOfThisInStock-CDBase[FindCustomerList].Or[i].Quantity;
//Invoice For Each Ordered Plant
CDBase[FindCustomerList].Or[i].Invoice=CDBase[FindCustomerList].Or[i].Quantity*PDBase[FindPlantList].Price;
//Quantity Solt For Each Plant Is Updated
PDBase[FindPlantList].QSell=PDBase[FindPlantList].QSell+CDBase[FindCustomerList].Or[i].Quantity;
inv=inv+CDBase[FindCustomerList].Or[i].Invoice;
cout<<"Continue.\n";
}
//Number Of Different Plants Ordered From This Customer is Updated
CDBase[FindCustomerList].HowM=CDBase[FindCustomerList].HowM+plus;
//Total Invoice Is Updated
CDBase[FindCustomerList].TotalInvoice=CDBase[FindCustomerList].TotalInvoice+inv;
//Turnover IS updated
CDBase[FindCustomerList].TurnOver=CDBase[FindCustomerList].TurnOver+CDBase[FindCustomerList].TotalInvoice;
}
//Question 2
if(choice1=='3') //If choice is 3
{
//Make A New Order
cout<<"*MAKE NEW ORDER*\n";
//Ask How Many Different Plant Is Going To Order
cout<<"Please Enter How Many Different Plants You Are Going To Order: \n";
cin>>CDBase[FindCustomerList].HowM;
//Make The New Order With This Function
MakeOrder ();
}
}
//Question 1
else //If Answer Is Not Yes The Action Modify Order Is Cancel
cout<<"\n**ACTION CANCELED**\n";
}
//Show Order That Made By A Customer
void ShowOrder ()
{
int i;
cout<<"\nCUSTOMER'S NAME: "<<cdbase[findcustomerlist].name<<endl; customer's="" name
cout<<"*order*\n";=""
="" for(i="0;" i<cdbase[findcustomerlist].howm;="" i++)
="" {
="" cout<<"\nplant="" #="" :="" "<<i+1<<endl;="" display="" out="" each="" ordered="" plant
="" cout<<"name:="" "<<cdbase[findcustomerlist].or[i].order<<endl;="" the="" quantity="" cout<<"quantity:="" "<<cdbase[findcustomerlist].or[i].quantity<<endl;="" cost
="" cout<<"cost="" "<<cdbase[findcustomerlist].or[i].invoice<<endl;=""
="" cout<<"__________________________________________\n\n";
="" }
="" total="" invoice="" for="" this="" order
="" cout<<"invoice="" "<<cdbase[findcustomerlist].totalinvoice<<endl;="" turnover="" customer
="" cout<<"turnover:="" "<<cdbase[findcustomerlist].turnover<<endl<<endl;
}
="" make="" order
void="" makeorder="" ()
{
="" int="" i;
="" float="" inv="0.0;
" cout<<"\n*select="" plants*\n";
="" loop="" such="" times="" as="" number="" of="" different="" plants="" cstomer="" wants="" to="" insert="" cout<<"plant="" #:="" findplant="" ();="" find="" plant="" giving="" its="" family="" and="" name
="" displays="" selected="" plant's="" cout<<"selected="" plant:="" "<<pdbase[findplantlist].plantfamily_name="" <<endl;
="" asks="" quantity
="" "<<endl;
="" cin="">>CDBase[FindCustomerList].Or[i].Quantity;
if(PDBase[FindPlantList].NumOfThisInStock<=0) //If The Quantity Of This Plant In Stock Is Zero
{
cout<<"There Are No Such Plants In Stock\n"; //Asks User To Change The Order By Selecting An Other Plant
cout<<"Please Change Your Order.\n";
cout<<"PLANT #: "<<i+1<<endl;
findplant="" ();
="" cout<<"selected="" plant:="" "<<pdbase[findplantlist].plantfamily_name="" <<endl;
="" cout<<"quantity:="" \n";
="" cin="">>CDBase[FindCustomerList].Or[i].Quantity;
}
//If The New Quantity Is Bigger Than The Quantity Of This Plant In Stock
if(CDBase[FindCustomerList].Or[i].Quantity>PDBase[FindPlantList].NumOfThisInStock)
{
//The Order Stop And Show How MAny Plant Of This Type Are Available
cout<<"Order Stoped\n";
cout<<"Available Quantity For This Is: "<<pdbase[findplantlist].numofthisinstock<<endl;
="" asks="" for="" a="" new="" quantity
="" cout<<"\nplease="" change="" quantity.="" quantity:="" \n";
="" cin="">>CDBase[FindCustomerList].Or[i].Quantity;
}
//Copy The Name Of Plant To The Array Order
strcpy(CDBase[FindCustomerList].Or[i].Order, PDBase[FindPlantList].PlantFamily_Name);
//Update The Number In Stock Of This Plant
PDBase[FindPlantList].NumOfThisInStock=PDBase[FindPlantList].NumOfThisInStock-CDBase[FindCustomerList].Or[i].Quantity;
//Calculate The Invoice For Each Plant
CDBase[FindCustomerList].Or[i].Invoice=CDBase[FindCustomerList].Or[i].Quantity*PDBase[FindPlantList].Price;
//Find The Total Invoice
inv=inv+CDBase[FindCustomerList].Or[i].Invoice;
//Keep The Quantity Sold Of This Plant
PDBase[FindPlantList].QSell=PDBase[FindPlantList].QSell+CDBase[FindCustomerList].Or[i].Quantity;
cout<<"Continue.\n";
}
//Total Invoice For The Order
CDBase[FindCustomerList].TotalInvoice=inv;
//Total Turnover Of This Customer
CDBase[FindCustomerList].TurnOver=CDBase[FindCustomerList].TurnOver+CDBase[FindCustomerList].TotalInvoice;
//Display The Order
ShowOrder ();
}
//Find Customer,
void InsertOrder ()
{
char q1; //Question 1
char q2; //Question 1
char q3; //Question 1
int HowMany;
cout<<"\n\t\t**ORDERING PROCESS**\n";
//Question 1: Ask If He/She Want To Continue The Order
cout<<"Are You Sure You Want To Continue Making An Order (y or n): "<<endl;
cin>>q1;
if((q1=='y')||(q1=='Y')) //If Answer Is Yes Program Continue The Ordering Process
{
cout<<"\n**FIND CUSTOMER**\n";
//Question 2: Ask If He/She Want To Show The Customers Are In The List
cout<<"Do You Want To Show First The Customers Are In The Database (y or n): "<<endl;
cin="">>q2;
if((q2=='y')||(q2=='Y')) //If Answer Is Yes
{
DisplayCustomers (); //Displays The Customers Are In The Database
cout<<"\nThese Are The Customers In The List\n";
cout<<"\n*Select Customer*\n";
//Find And Select The Customer Who Is Going To Make This Order
FindCustomer();
}
//If Answer Is No
else
{
//Select The Customer
cout<<"\n*SELECTED CUSTOMER*\n";
FindCustomer(); //Find Customer Giving His/Her Social Security Number
}
//Display Selected Customer With His/Her Personal Information
cout<<"\n*SELECTED CUSTOMER*\n";
cout<<"_______________________\n";
cout<<"CUSTOMER #: "<<findcustomerlist+1<<endl;
cout<<"name="" :="" "<<cdbase[findcustomerlist].name<<endl;
="" cout<<"address="" "<<cdbase[findcustomerlist].address<<endl;
="" cout<<"phone="" number="" "<<cdbase[findcustomerlist].phone<<endl;
="" cout<<"social="" sec="" num:="" "<<cdbase[findcustomerlist].socialsecuritynum<<endl;
="" cout<<endl<<endl;
="" cout<<"*now="" you="" can="" insert="" the="" order*\n";
=""
="" question="" 3:="" ask="" if="" user="" wants="" to="" show="" plants="" are="" in="" database
="" cout<<"do="" want="" database="" (y="" or="" n):="" \n";
="" cin="">>q3;
if((q3=='y')||(q3=='Y')) //If Answer Is Yes
{
//Displays The Plants Are In The List
cout<<"\n\n**SHOW AVAILABLE PLANTS**"<<endl;
displayplants="" ();
="" cout<<"\nthese="" are="" the="" available="" plants\n\n";
="" and="" ask="" number="" of="" different="" plants="" he="" she="" is="" going="" to="" order=""
="" cout<<"please="" enter="" how="" many="" you="" order:\n";
="" cin="">>HowMany;
}
//Question 3: If Answer Is No
else
{
//Ask Only The Number Of Different Plants He/She Is Going To Order
cout<<"Please Enter How Many Different Plants You Are Going To Order:\n";
cin>>HowMany;
}
//This Value Stored In The Array (Same Place As The Information Of Customer)
CDBase[FindCustomerList].HowM=HowMany;
//Make The Order
MakeOrder ();
}
//Question 1: If Answer Is No
//Orderin Process Cancel
else
cout<<"*ACTION CANCELED*"<<endl;
}
=""
="" delete="" plant
void="" deletep="" ()
{
="" int="" i;
="" char="" yorn;
cout<<"\n**delete="" plant="" from="" database**\n";
="" cout<<"_________________________________\n";
findplant="" ();="" find="" the="" giving="" its="" family="" and="" name
="" cout<<"plant="" #:="" "<<findplantlist+1<<endl;
="" cout<<"family="" &="" name:="" "<<pdbase[findplantlist].plantfamily_name<<endl;
="" cout<<"type="" :="" "<<pdbase[findplantlist].type<<endl;="" display="" plant's="" information
="" cout<<"colour="" "<<pdbase[findplantlist].colour<<endl;="" so="" user="" to="" be="" sure="" that="" cout<<"size="" "<<pdbase[findplantlist].size<<endl;="" this="" is="" he="" she="" want
="" cout<<"in="" stock="" "<<pdbase[findplantlist].numofthisinstock<<endl;="" delete
="" cout<<"garden="" "<<pdbase[findplantlist].itisgarden<<endl;
="" cout<<"price="" "<<pdbase[findplantlist].price<<endl;
="" cout<<endl;
="" ask="" if="" want="" plant
="" cout<<"are="" you="" (y="" or="" n):="" "<<endl;
="" cin="">>YorN;
if((YorN=='y')||(YorN=='Y')) //If Answer Is Yes
{
for(i=FindPlantList; i<noofplants; i++)="" loop="" from="" the="" place="" that="" is="" selected="" up="" to=""
="" {="" number="" of="" plants="" in="" list
="" strcpy(pdbase[i].plantfamily_name,="" pdbase[i+1].plantfamily_name);="" change="" cell="" array
="" strcpy(pdbase[i].type,="" pdbase[i+1].type);
="" strcpy(pdbase[i].size,="" pdbase[i+1].size);
="" pdbase[i].numofthisinstock="PDBase[i+1].NumOfThisInStock;
" strcpy(pdbase[i].itisgarden,="" pdbase[i+1].itisgarden);
="" pdbase[i].price="PDBase[i+1].Price;
" }
="" noofplants="NoOfPlants-1;" list="" less="" 1="" if="" (noofplants="" <="" 0)
="" {
="" smaller="" value="" counter="" database="" can="" have="" zero
="" cout<<"*plant="" deleted*"<<endl;
="" answer="" no="" action="" canceled
="" else
="" cout<<"*action="" canceled*"<<endl;
}
="" delete="" customer
void="" deletec="" ()
{
="" int="" i;
="" char="" yorn;
="" cout<<"\n**delete="" customer="" database**\n";
="" cout<<"_________________________________\n";
="" findcustomer();="" find="" giving="" his="" her="" social="" security=""
="" cout<<"customer="" #:="" "<<findcustomerlist+1<<endl;
="" cout<<"name="" :="" "<<cdbase[findcustomerlist].name<<endl;="" display="" customer
="" cout<<"address="" "<<cdbase[findcustomerlist].address<<endl;
="" cout<<"phone="" "<<cdbase[findcustomerlist].phone<<endl;
="" cout<<"social="" sec="" num:="" "<<cdbase[findcustomerlist].socialsecuritynum<<endl;
="" cout<<endl<<endl;
="" ask="" he="" she="" sure="" want="" this="" cout<<"are="" you="" (y="" or="" n):="" "<<endl;
="" cin="">>YorN;
if((YorN=='y')||(YorN=='Y')) //If Answer is Yes
{
for(i=FindCustomerList; i<noofcustomers; i++)="" loop="" from="" the="" place="" in="" array="" that="" is="" this="" customer
="" {="" up="" to="" number="" of="" customers="" list
="" strcpy(cdbase[i].name,="" cdbase[i+1].name);
="" strcpy(cdbase[i].address,="" cdbase[i+1].address);="" change="" cell="" array
="" strcpy(cdbase[i].phone,="" cdbase[i+1].phone);
="" strcpy(cdbase[i].socialsecuritynum,="" cdbase[i+1].socialsecuritynum);
="" }
="" noofcustomers="NoOfCustomers-1;
" if="" (noofcustomers="" <="" 0)
="" {
="" smaller="" value="" counter="" database="" can="" have="" zero
="" cout<<"*customer="" deleted*"<<endl;
="" answer="" no="" delete="" action="" cancel
else=""
="" cout<<"*action="" canceled*"<<endl;
}
="" modify="" plant's="" information
void="" modifyplant="" ()
{
="" char="" yorn;
="" cout<<"\n**modify="" information**\n";
="" cout<<"______________________________\n";
="" findplant="" ();="" find="" plant="" giving="" its="" family="" and="" name
="" cout<<"plant="" #:="" "<<findplantlist+1<<endl;
="" cout<<"family="" &="" name:="" "<<pdbase[findplantlist].plantfamily_name<<endl;
="" cout<<"type="" :="" "<<pdbase[findplantlist].type<<endl;="" displays="" out="" information
="" cout<<"colour="" "<<pdbase[findplantlist].colour<<endl;="" plant
="" cout<<"size="" "<<pdbase[findplantlist].size<<endl;
="" cout<<"in="" stock="" "<<pdbase[findplantlist].numofthisinstock<<endl;
="" cout<<"garden="" "<<pdbase[findplantlist].itisgarden<<endl;
="" cout<<"price="" "<<pdbase[findplantlist].price<<endl;
="" cout<<endl<<endl;
="" cout<<"now="" enter="" new="" information="" for="" plant\n="" "
="" <<"(you="" can't="" name)\n";
="" cout<<"_____________________________________________\n";
="" cout<<"are="" you="" sure="" want="" (y="" or="" n):="" "<<endl;
="" cin="">>YorN;
//If Answer Is Yes Program Continues With The Modification
if((YorN=='y')||(YorN=='Y'))
{
cout<<"**MODIFICATIONS**: "<<endl;
cout<<"type:="" "<<endl;
="" gets(pdbase[findplantlist].type);="" user="" can="" modify="" some="" of="" plant's="" info
="" cout<<"colour:="" gets(pdbase[findplantlist].colour);
="" cout<<"size:="" gets(pdbase[findplantlist].size);
="" cout<<"how="" many="" are="" in="" stock:="" cin="">>PDBase[FindPlantList].NumOfThisInStock;
cout<<"IT IS A GARDEN PLANT: "<<endl;
gets(pdbase[findplantlist].itisgarden);
="" cout<<"price:="" "<<endl;
="" cin="">>PDBase[FindPlantList].Price;
cout<<"\n\n**You Have Modify "<<pdbase[findplantlist].plantfamily_name<<" information**\n";
="" }
else
="" if="" answer="" is="" no="" modification="" action="" canceled
="" cout<<"*action="" canceled*"<<endl;
}
="" find="" plant's="" place="" in="" the="" list
void="" findplant="" ()
{
="" int="" i;
="" finder="0;" counts="" and="" cell="" array="" where="" plant="" user="" looking="" for="" is
="" char="" pfamily_name[40];="" insert="" family="" name="" of="" he="" she="" want="" to="" find
="" tmp1="0;
"
="" cout<<"please="" enter="" &="" (ie.family(space)name):="" "<<endl;
="" gets(pfamily_name);
="" for(i="0;" i<noofplants;="" i++)="" loop="" number="" plants="" (noofplants)="" are="" array
="" {
="" pfamily_name);="" compare="" with="" evry=""
="" this="" not="" working="" correctly="" (tmp1="" !="0)
//Using" ok!!!
="" {="" input="" same="" compared="" finder++;="" counter="" "finder"="" incresing="" by="" 1
="" }
="" }
="" -="" 1="" equal="" (cell)=""
findplantlist="Finder-1;
}
//Modify" customers="" information
void="" modifycustomer="" yorn;
="" cout<<"\n**modify="" customer's="" cout<<"____________________________________\n\n";
="" findcustomer();="" customer="" giving="" his="" her="" social="" security="" number
="" cout<<"customer="" #:="" "<<findcustomerlist+1<<endl;
="" cout<<"name="" :="" "<<cdbase[findcustomerlist].name<<endl;
="" cout<<"address="" "<<cdbase[findcustomerlist].address<<endl;
="" cout<<"phone="" "<<cdbase[findcustomerlist].phone<<endl;
="" cout<<"social="" sec="" num:="" "<<cdbase[findcustomerlist].socialsecuritynum<<endl;
="" cout<<endl<<endl;
="" cout<<"\nnow="" new="" information="" customer\n="" "
="" <<"(you="" can't="" change="" number)\n";
="" cout<<"_________________________________________________\n";
="" ask="" sure="" continue="" modify="" customer
="" cout<<"are="" you="" (y="" or="" n):="" cin="">>YorN;
//If Answer Is Yes
if((YorN=='y')||(YorN=='Y'))
{ //User Can Change Some Of The Information
cout<<"**MODIFICATIONS**: "<<endl;
cout<<"address:="" "<<endl;
="" gets(cdbase[findcustomerlist].address);
="" cout<<"phone="" number:="" gets(cdbase[findcustomerlist].phone);
=""
cout<<"\n\n**you="" have="" modify="" "<<cdbase[findcustomerlist].name<<"="" information**\n";
="" }
="" if="" answer="" is="" no="" modification="" process="" canceled
else
="" cout<<"*action="" canceled*"<<endl;
}
="" find="" customer's="" place="" in="" the="" list
void="" findcustomer()
{
="" int="" i;
="" finder="0;" counts="" to="" cell="" array="" where="" customer="" user="" looking="" for
="" char="" social[15];="" social="" security="" number="" of="" looking
="" tmp="0;
"
="" cout<<"enter="" gets(social);
="" for(i="0;" i<noofcustomers;="" i++)
="" {
="" social);="" compare="" with="" evry="" array
="" this="" not="" working="" correctly="" (tmp1="" !="0)
//Using" ok!!!="" (tmp="" same="" counter="" "finder"="" incresing="" by="" 1="" finder++;
="" }
="" "finder"-1="" equal="" (cell)="" that=""
findcustomerlist="Finder-1;
}
//Return" how="" many="" customers="" are="" list="" and="" can="" still="" insert="" database
="" displays="" alphabetical="" order
void="" howmanycustomers="" ()
{
="" cout<<endl;="" displaycustomers="" ();="" order
="" display="" list
="" cout<<"\nthere="" "<<noofcustomers<<"="" database."<<endl;
="" calculate="" be="" counterc="MaxNoOfCustomers-NoOfCustomers;
" cout<<"you="" "<<counterc<<"="" other="" database."<<endl;
}
="" out="" order="" all="" there="" personal="" information=""
void="" ()
{
="" i;
="" i++)="" loop="" times
="" information
="" cout<<"customer="" #:="" "<<i+1<<endl;
="" cout<<"name="" :="" "<<cdbase[i].name<<endl;
="" cout<<"address="" "<<cdbase[i].address<<endl;
="" "<<cdbase[i].phone<<endl;
="" cout<<"security="" "<<cdbase[i].socialsecuritynum<<endl;
="" cout<<"____________________________________\n"<<endl;
="" }
}
="" plants="" information
void="" displayplants="" i<noofplants;="" cout<<endl;
="" cout<<"plant="" "<<i+1<<endl;="" plant's="" cout<<"family="" &="" name="" "<<pdbase[i].plantfamily_name<<endl;
="" cout<<"type="" "<<pdbase[i].type<<endl;
="" cout<<"colour="" "<<pdbase[i].colour<<endl;
="" cout<<"size="" "<<pdbase[i].size<<endl;
="" cout<<"in="" stock="" "<<pdbase[i].numofthisinstock<<endl;
="" cout<<"garden="" plant="" "<<pdbase[i].itisgarden<<endl;
="" cout<<"price="" "<<pdbase[i].price<<endl;
="" cout<<"____________________________________\n"<<endl;
="" }
}
="" return="" database
void="" howmanyplants="" "<<noofplants<<"="" different="" counterp="MaxNoOfPlants-NoOfPlants;
" "<<counterp<<"="" new="" database.="" keep="" them="" readnewcustomer="" ()
{
int="" i="0,j=0;
char" tempcname[30];="" these="" temps="" used="" aplhabetical="" order
char="" tempcaddress[80];
char="" tempcphone[10];
char="" tempcsecurity[15];
int="" tmp,="" tmp1;
="" cout<<"\ncustomer="" "<<noofcustomers+1<<endl;="" cout<<"name:="" gets(cdbase[noofcustomers].name);
="" gets(cdbase[noofcustomers].address);
="" gets(cdbase[noofcustomers].phone);
="" number:\n="" "="" <<"first="" enter="" first="" letter="" \n"
="" <<"his="" her="" last="" then="" number\n"
="" <<"(eg.="" 'nicholas="" try'="" write:ec22332):="" "<<endl;="" beacause="" we="" sort="" accorting="" number
="" gets(cdbase[noofcustomers].socialsecuritynum);
="" noofcustomers++;="" increasing="" one
for(i="0;" order
{
="" for(j="0;" j<noofcustomers;="" j++)
="" cdbase[j].name);
="" tmp1="strcmp(CDBase[i].SocialSecurityNum," cdbase[j].socialsecuritynum);
="" ((tmp<0)&&(tmp1<0))="" next="" smaller(alphabetically)
="" strcpy(tempcname,="" cdbase[i].name);="" exchange="" cells="" array
="" strcpy(tempcaddress,="" cdbase[i].address);
="" strcpy(tempcphone,="" cdbase[i].phone);
="" strcpy(tempcsecurity,="" cdbase[i].socialsecuritynum);
="" strcpy(cdbase[i].name,="" strcpy(cdbase[i].address,="" cdbase[j].address);
="" strcpy(cdbase[i].phone,="" cdbase[j].phone);
="" strcpy(cdbase[i].socialsecuritynum,="" strcpy(cdbase[j].name,="" tempcname);
="" strcpy(cdbase[j].address,="" tempcaddress);
="" strcpy(cdbase[j].phone,="" tempcphone);
="" strcpy(cdbase[j].socialsecuritynum,="" tempcsecurity);
="" }
}
}
="" readnewplant="" temppfamily_name[30];="" tempptype[8];
char="" temppcolour[10];
char="" temppsize[8];
int="" temppinstock;
char="" temppisagarden[3];
float="" temppprice="0.0;
int" asked="" about="" information
="" cout<<"\nplant="" "<<noofplants+1<<endl;
="" family="" (ie.="" family(space)name):="" gets(pdbase[noofplants].plantfamily_name);
="" its="" type(flower="" or="" tree):="" gets(pdbase[noofplants].type);
="" colour="" blossom:="" gets(pdbase[noofplants].colour);
="" cout<<"please="" size(small,="" medium,="" large):="" gets(pdbase[noofplants].size);
="" cout<<"how="" stock:="" cin="">>PDBase[NoOfPlants].NumOfThisInStock;
cout<<"IT IS A GARDEN FLOWER ? (Yes Or No): "<<endl;
gets(pdbase[noofplants].itisgarden);
="" cout<<"enter="" its="" price:="" "<<endl;
="" cin="">>PDBase[NoOfPlants].Price;
cout<<endl;
counter1="counter1+PDBase[NoOfPlants].NumOfThisInStock;
"
="" noofplants++;="" number="" of="" plants="" in="" the="" array="" increase="" by="" 1=""
for(i="0;" i<noofplants;="" i++)="" alphabetical="" order
{
="" for(j="0;" j<noofplants;="" j++)="" if="" next="" plant's="" family="" and="" name="" is="" smaller(alphabetically)
="" {="" tmp1="strcmp(PDBase[i].PlantFamily_Name," pdbase[j].plantfamily_name);
="" exchange="" cells="" array
="" (tmp1<0)
="" {
="" strcpy(temppfamily_name,="" pdbase[i].plantfamily_name);
="" strcpy(tempptype,="" pdbase[i].type);
="" strcpy(temppcolour,="" pdbase[i].colour);
="" strcpy(temppsize,="" pdbase[i].size);
="" temppinstock="PDBase[i].NumOfThisInStock;
" strcpy(temppisagarden,="" pdbase[i].itisgarden);
="" temppprice="PDBase[i].Price;
" strcpy(pdbase[i].plantfamily_name,="" strcpy(pdbase[i].type,="" pdbase[j].type);
="" strcpy(pdbase[i].colour,="" pdbase[j].colour);
="" strcpy(pdbase[i].size,="" pdbase[j].size);
="" pdbase[i].numofthisinstock="PDBase[j].NumOfThisInStock;
" strcpy(pdbase[i].itisgarden,="" pdbase[j].itisgarden);
="" pdbase[i].price="PDBase[j].Price;
" strcpy(pdbase[j].plantfamily_name,="" temppfamily_name);
="" strcpy(pdbase[j].type,="" tempptype);
="" strcpy(pdbase[j].colour,="" temppcolour);
="" strcpy(pdbase[j].size,="" temppsize);
="" pdbase[j].numofthisinstock="tempPInStock;
" strcpy(pdbase[j].itisgarden,="" temppisagarden);
="" pdbase[j].price="tempPPrice;
" }
="" }
}
}
="" display="" main="" menu
void="" showmenu="" ()
{
="" cout<<"________________________________________________________________________________"<<endl;
="" cout<<"\t\t\t="" nursery="" garden="" company\n";
="" cout<<"\t\t="" ********************************\n";
="" cout<<"\t\t\t\tmain="" menu\n\n";
="" cout<<"="" 0.exit\n";
="" 1.read="" information="" for="" a="" new="" plant.\n";
="" 2.read="" customer.="" \n";
="" 3.show="" how="" many="" are="" list="" -="" can="" still="" be="" inseret.\n";
="" 4.show="" customers="" insert.="" 5.delete="" plant="" given="" its="" name.\n";
="" 6.delete="" customer="" his="" her="" social="" security="" number.\n";
="" 7.insert="" an="" order.\n";
="" 8.modify="" data="" particular="" 9.modify="" customer.\n";
="" cout<<"10.modify="" cout<<"11.view="" cout<<"12.view="" reports.\n";
="" cout<<"________________________________________________________________________________\n";
cout<<endl;
}
="" execude="" user's="" choice
void="" choosemenu="" (int="" menu)
{
="" switch="" (menu)
="" case="" 0:
="" cout<<"\nexit.............="" bye="" bye!!!\n\n";
="" break;
="" 1:
="" readnewplant="" ();
="" 2:
="" readnewcustomer="" 3:
="" howmanyplants="" break;
="" 4:
="" howmanycustomers="" 5:
="" deletep="" 6:
="" deletec="" 7:
="" insertorder="" 8:
="" modifyplant="" 9:
="" modifycustomer="" 10:
="" modifyorder="" 11:
="" vieworder="" 12:
="" reportchoose="" default:
="" cout<<"invalid="" number"<<endl;
="" cout<<"insert="" one="" above:="" ";
="" cin="">>menu;
}
}
}
//Main Program
void main ()
{
do
{
ShowMenu (); //View Menu
cout<<"Choose an action: ";
cin>>menu;
ChooseMenu (menu);
}while(menu != 0);
}
|
|
|
|
|