Escolar Documentos
Profissional Documentos
Cultura Documentos
class Paints { protected: int classfication,medium,subject; int classfi; int end; char code[3]; double target_price,actual_price,selling_price,max_purchase,height,width; string name_1,name_2,title_work,date_work,date_purchase; string name_seller,date_sell,address_buyer,name_buyer; list<double> Height; list<double>Width; list<double>Max_purchase; list<int>Classfication; list<int>Medium; list<int>Subject; list<double>Target_price; list<double>Actual_price; list<string>Name_1; list<string>Name_2; list<string>Title_work;
list<double> SHeight; list<double>SWidth; list<int>SClassfication; list<int>SMedium; list<int>SSubject; list<string>STitle_work; list<string>SDate_work; list<string>SDate_sell; list<string>SAddress_buyer; list<double>SSelling_price; list<string>SName_buyer;
list<double> THeight; list<double>TWidth; list<double>TMax_purchase; list<int>TClassfication; list<int>TMedium; list<int>TSubject; list<double>TTarget_price; list<double>TActual_price; list<string>TName_1; list<string>TName_2;
list<double> TSHeight; list<double>TSWidth; list<int>TSClassfication; list<int>TSMedium; list<int>TSSubject; list<string>TSTitle_work; list<string>TSDate_work; list<string>TSDate_sell; list<string>TSAddress_buyer; list<double>TSSelling_price; list<string>TSName_buyer;
public: int purchase_paint(void); void getdetails(); void recievedetails(); int sell_paint(); int display_output_1(); int display_output_2(); void empty_p(); void fill_p(); void empty_S();
void fill_S(); double coefficient(void); }; void Paints::getdetails() { end=0; cout<<"--------------------------------"<<endl; cout<<"Enter the first name of the artist:"; cin>>name_1; cout<<"--------------------------------"<<endl; cout<<"Enter the last name of the artist:"; cin>>name_2; cout<<"--------------------------------"<<endl; cout<<"Enter title of work:"; cin>>title_work; cout<<"--------------------------------"<<endl; cout<<"Enter date of work:"; cin>>date_work; cout<<"--------------------------------"<<endl; cout<<"Enter height:"; cin>>height; cout<<"--------------------------------"<<endl; cout<<"Enter width:"; cin>>width; cout<<"--------------------------------"<<endl; cout<<"[1] Oil"<<endl; cout<<"[2] Watercolor"<<endl;
cout<<"[3] Others"<<endl; cout<<"Enter medium code:"; cin>>medium; cout<<"--------------------------------"<<endl; cout<<"[1] Portrait"<<endl; cout<<"[2] Still-life"<<endl; cout<<"[3] Landscape"<<endl; cout<<"[4] Others"<<endl; cout<<"Enter subject code:"; cin>>subject; cout<<"--------------------------------"<<endl; cout<<"Enter date of purchase:"; cin>>date_purchase; cout<<"--------------------------------"<<endl; cout<<"Enter name of seller:"; cin>>name_seller; cout<<"--------------------------------"<<endl; cout<<"Enter actual purchase price :"; cin>>actual_price; if(classfi=1 && atoi(code)==2) { if (actual_price > max_purchase) { cout<<"The buying price is greater than the maximum purchase price."<<endl; end=1; } }
if(classfi=1 && atoi(code)==1) { if (actual_price > max_purchase) { cout<<"The buying price is greater than the maximum purchase price."<<endl; end=1; } }
double Paints::coefficient() { list<double>H; list<double>W; list<int>M; list<int>S; int n,k,area_1,area_2,S_,S2; double coef=0.0; int score1; score1=0; int score2; score2=0; if (classfi=1) {
area_1=Height.back()*Width.back(); k=Medium.back();M.push_front(Medium.back()); S_=Subject.back();S.push_front(Subject.back()); Subject.pop_back(); S2=Subject.back(); Medium.pop_back(); n=Medium.back(); H.push_front(Height.back());W.push_front(Width.back()); Height.pop_back();Width.pop_back(); area_2=Height.back()*Width.back();
return coef; }
cout<<"--------------------------------"<<endl;
cout<<"[1] Masterpiece"<<endl; cout<<"[2] Masterwork"<<endl; cout<<"[3] Masterpiece and Masterwork."<<endl; cout<<"[4] Others"<<endl; cout<<"Enter classfication code:"; cin>>code; if(atoi(code)<=0 || atoi(code) > 4) { cout<<"This code does not exist."<<endl; purchase_paint(); } else { if(atoi(code)==3) { classfi=1; p=1; for(int i=0;i<=p;i++) { cout<<"Enter classfication "<<i+1<<" :"; cin>>classfication; getdetails(); if(end==0) { recievedetails(); } else
{ purchase_paint(); } } coefficient(); if(coefficient()==0) { cout<<"This painting can't be bought."<<endl; } } else if(atoi(code)==2) { double auction=0.0; classfication=2; cout<<"Enter the auction price:"; cin>>auction; max_purchase=auction+((8.5/100)*auction); Max_purchase.push_back(max_purchase); getdetails(); if(end==0) { recievedetails(); } else { purchase_paint();
} } else if(atoi(code)==1) { classfication=1; double auction=0.0; double century=0.0; cout<<"Enter the auction price:"; cin>>auction; max_purchase=auction+((8.5/100)*auction); cout<<"Enter century: "; cin>>century; if(century<13 || century>20) { cout<<"Wrong century"<<endl; purchase_paint(); } else if(century==20) { max_purchase=((0.25)*max_purchase); } else { max_purchase=(((20-century)/(21century))*max_purchase); }
getdetails(); if(end==0) { recievedetails(); } else { purchase_paint(); } } else if(atoi(code)==4) { int f; double A; cout<<"Enter the F constant:"; cin>>f; classfication=4; getdetails(); recievedetails(); A=Height.back()*Width.back(); max_purchase=A*f; if(actual_price > max_purchase || f==0) { cout<<"This painter can't be bought."<<endl;
Height.pop_back();
Width.pop_back(); Classfication.pop_back(); Medium.pop_back(); Subject.pop_back(); Target_price.pop_back(); Actual_price.pop_back(); Name_1.pop_back(); Name_2.pop_back(); Title_work.pop_back(); Date_work.pop_back(); Date_purchase.pop_back(); Name_seller.pop_back(); purchase_paint();
} } } return 0; }
int Paints::sell_paint() {
cout<<"--------------------------------"<<endl; cout<<"Enter date of work:"; cin>>date_work; SDate_work.push_back(date_work); cout<<"--------------------------------"<<endl; cout<<"[1] Masterpiece"<<endl; cout<<"[2] Masterwork"<<endl; cout<<"[3] Others"<<endl; cout<<"Enter classfication code:"; cin>>classfication; SClassfication.push_back(classfication); cout<<"--------------------------------"<<endl; cout<<"Enter height:"; cin>>height; SHeight.push_back(height); cout<<"--------------------------------"<<endl; cout<<"Enter width:"; cin>>width; SWidth.push_back(width); cout<<"--------------------------------"<<endl; cout<<"[1] Oil"<<endl; cout<<"[2] Watercolor"<<endl; cout<<"[3] Others"<<endl; cout<<"Enter medium code:"; cin>>medium; SMedium.push_back(medium); cout<<"--------------------------------"<<endl;
cout<<"[1] Portrait"<<endl; cout<<"[2] Still-life"<<endl; cout<<"[3] Landscape"<<endl; cout<<"[4] Others"<<endl; cout<<"Enter subject code:"; cin>>subject; SSubject.push_back(subject); cout<<"--------------------------------"<<endl; cout<<"Enter date of selling:"; cin>>date_sell; SDate_sell.push_back(date_sell); cout<<"--------------------------------"<<endl; cout<<"Enter name of buyer:"; cin>>name_buyer; SName_buyer.push_back(name_buyer); cout<<"--------------------------------"<<endl; cout<<"Enter actual selling price : "; cin>>selling_price; SSelling_price.push_back(selling_price); cout<<"--------------------------------"<<endl; cout<<"Enter address of buyer:"; cin>>address_buyer; SAddress_buyer.push_back(address_buyer); cout<<"--------------------------------"<<endl;
return 0; }
int Paints::display_output_1() { cout<<"-----All paintings purchased last year------"<<endl; cout<<"--------------------------------------------"<<endl; int k=Name_1.size(); for(int i=0;i<=k-1;i++) { cout<<"First name of artist: "<<Name_1.front()<<endl; cout<<"Last name of artist: "<<Name_2.front()<<endl; cout<<"Title of work: cout<<"Date of work: "<<Title_work.front()<<endl; "<<Date_work.front()<<endl;
if(Classfication.front()==1) { cout<<"Classfication: } else if(Classfication.front()==2) { cout<<"Classfication: } else if(Classfication.front()==4) { cout<<"Classfication: } Others"<<endl; Masterwork"<<endl; Masterpiece"<<endl;
else { cout<<"Classfication: } cout<<"Height: cout<<"Width: if(Medium.front()==1) { cout<<"Medium: } else if(Medium.front()==2) { cout<<"Medium: } else if(Medium.front()==3) { cout<<"Medium: } else { cout<<"Medium: } Unknown"<<endl; Others"<<endl; Watercolor"<<endl; Oil"<<endl; "<<Height.front()<<endl; "<<Width.front()<<endl; Unknown"<<endl;
if(Subject.front()==1) {
cout<<"Subject: } else
Portrait."<<endl;
if(Subject.front()==2) { cout<<"Subject: } else if(Subject.front()==3) { cout<<"Subject: } else if(Subject.front()==4) { cout<<"Subject: Others."<<endl; } else { cout<<"Subject: Unknown."<<endl; Landscape."<<endl; Still-Life."<<endl;
int Paints::display_output_2() { cout<<"-------All paintings sold last year---------"<<endl; cout<<"--------------------------------------------"<<endl; int k=STitle_work.size(); for(int i=0;i<=k-1;i++) { cout<<"Title of work: cout<<"Date of work: if(SClassfication.front()==1) { cout<<"Classfication: } else if(SClassfication.front()==2) { cout<<"Classfication: } else if(SClassfication.front()==4) { Masterwork"<<endl; Masterpiece"<<endl; "<<STitle_work.front()<<endl; "<<SDate_work.front()<<endl;
Others"<<endl;
Unknown"<<endl;
"<<SHeight.front()<<endl; "<<SWidth.front()<<endl;
Oil"<<endl;
if(SMedium.front()==2) { cout<<"Medium: } else if(SMedium.front()==3) { cout<<"Medium: } else { cout<<"Medium: Unknown"<<endl; } Others"<<endl; Watercolor"<<endl;
if(SSubject.front()==1) { cout<<"Subject: } else if(SSubject.front()==2) { cout<<"Subject: } else if(SSubject.front()==3) { cout<<"Subject: } else if(SSubject.front()==4) { cout<<"Subject: Others."<<endl; } else { cout<<"Subject: Unknown."<<endl; } Landscape."<<endl; Still-Life."<<endl; Portrait."<<endl;
"<<SDate_sell.front()<<endl; "<<SName_buyer.front()<<endl;
TSWidth.push_front(SWidth.front()); SWidth.pop_front();
TSClassfication.push_front(SClassfication.front()); SClassfication.pop_front();
TSMedium.push_front(SMedium.front()); SMedium.pop_front();
TSSubject.push_front(SSubject.front()); SSubject.pop_front();
TSTitle_work.push_front(STitle_work.front()); STitle_work.pop_front();
TSDate_work.push_front(SDate_work.front()); SDate_work.pop_front();
TSDate_sell.push_front(SDate_sell.front()); SDate_sell.pop_front();
TSName_buyer.push_front(SName_buyer.front()); SName_buyer.pop_front();
TSSelling_price.push_front(SSelling_price.front()); SSelling_price.pop_front();
TSAddress_buyer.push_front(SAddress_buyer.front()); SAddress_buyer.pop_front();
SWidth.push_front(TSWidth.front()); TSWidth.pop_front();
SClassfication.push_front(TSClassfication.front()); TSClassfication.pop_front();
SMedium.push_front(TSMedium.front()); TSMedium.pop_front();
SSubject.push_front(TSSubject.front()); TSSubject.pop_front();
STitle_work.push_front(TSTitle_work.front()); TSTitle_work.pop_front();
SDate_work.push_front(TSDate_work.front()); TSDate_work.pop_front();
SDate_sell.push_front(TSDate_sell.front()); TSDate_sell.pop_front();
SName_buyer.push_front(TSName_buyer.front()); TSName_buyer.pop_front();
SSelling_price.push_front(TSSelling_price.front()); TSSelling_price.pop_front();
SAddress_buyer.push_front(TSAddress_buyer.front()); TSAddress_buyer.pop_front(); }
TWidth.push_front(Width.front()); Width.pop_front();
TClassfication.push_front(Classfication.front()); Classfication.pop_front();
TMedium.push_front(Medium.front()); Medium.pop_front();
TSubject.push_front(Subject.front()); Subject.pop_front();
TTarget_price.push_front(Target_price.front()); Target_price.pop_front();
TActual_price.push_front(Actual_price.front()); Actual_price.pop_front();
TName_1.push_front(Name_1.front()); Name_1.pop_front();
TName_2.push_front(Name_2.front()); Name_2.pop_front();
TTitle_work.push_front(Title_work.front()); Title_work.pop_front();
TDate_work.push_front(Date_work.front()); Date_work.pop_front();
TDate_purchase.push_front(Date_purchase.front()); Date_purchase.pop_front();
TName_seller.push_front(Name_seller.front()); Name_seller.pop_front();
{ Height.push_front(THeight.front()); THeight.pop_front();
Width.push_front(TWidth.front()); TWidth.pop_front();
Classfication.push_front(TClassfication.front()); TClassfication.pop_front();
Medium.push_front(TMedium.front()); TMedium.pop_front();
Subject.push_front(TSubject.front()); TSubject.pop_front();
Target_price.push_front(TTarget_price.front()); TTarget_price.pop_front();
Actual_price.push_front(TActual_price.front()); TActual_price.pop_front();
Name_1.push_front(TName_1.front()); TName_1.pop_front();
Name_2.push_front(TName_2.front()); TName_2.pop_front();
Title_work.push_front(TTitle_work.front()); TTitle_work.pop_front();
Date_work.push_front(TDate_work.front()); TDate_work.pop_front();
Date_purchase.push_front(TDate_purchase.front()); TDate_purchase.pop_front();
Name_seller.push_front(TName_seller.front()); TName_seller.pop_front(); }
} void main() { Paints obj; char opt[3]; for(int i=0;i>=0;i++) { cout<<"------------------------------"<<endl; cout<<"[1] Purchase Paints."<<endl; cout<<"[2] Sell Paints."<<endl; cout<<"[3] Display purchased Paints."<<endl; cout<<"[4] Display sold Paints."<<endl; cout<<"[0] Exit."<<endl;
cout<<"Enter your option:"; cin>>opt; switch(atoi(opt)) { case 1: { obj.purchase_paint(); break; } case 2: { obj.sell_paint(); break; } case 3: { obj.display_output_1(); break; } case 4: { obj.display_output_2(); break; } case 0: { exit(1);
break; } default: {
break; } } }