Professional Documents
Culture Documents
#include <vector>
#include <string>
#include <iomanip>
#include <algorithm>
Person(){
mProducts = "None";
mSalary = 0;
mName = "";
}
Person(string nume,string produse,double salariu){
mProducts =produse;
mSalary=salariu;
mName=nume;
}
bool operator== (const Person& p)const{
if(mName == p.mName && mSalary == p.mSalary)
return true;
else
return false;
}
bool operator< (const Person& p)const{
if(mName.size() < p.mName.size())
return true;
else
return false;
}
string getName(){
return mName;
}
double getSalary(){
return mSalary;
}
string getProduct(){
return mProducts;
}
};
class Product{
};
class Store{
protected:
string mStoreName;
string mType;
vector<Person> mBuyers;
vector<Product> mProducts;
public:
Store(string nume, string tip){
mStoreName = nume;
mType = tip;
}
virtual void add(const Person& adaugare)=0;
virtual void remove(const Person& stergere)=0;
virtual void addProduct(const Product& adaugare)=0;
virtual void removeProduct(const Product& stergere)=0;
nr = 0;
cout << "Number of Markets: ";
for (int i = 0; i < store.size(); i++) {
if (store[i]->getType() == "Market") {
nr++;
}
}
cout << nr << endl;
nr = 0;
cout << "Number of SuperMarkets: ";
for (int i = 0; i < store.size(); i++) {
if (store[i]->getType() == "SuperMarket") {
nr++;
}
}
cout << nr << endl;
nr = 0;
cout << "Number of Malls: ";
for (int i = 0; i < store.size(); i++) {
if (store[i]->getType() == "Malls") {
nr++;
}
}
cout << nr_mall << endl;
nr = 0;
cout << "Average Salary for MiniMarkets ";
for (int i = 0; i < store.size(); i++) {
if (store[i]->getType() == "MiniMarket") {
suma = 0;
nr = 0;
cout << "Average Salary for SuperMarkets ";
for (int i = 0; i < store.size(); i++) {
if (store[i]->getType() == "SuperMarket") {
suma = 0;
nr = 0;
cout << "Average Salary for Malls ";
for (int i = 0; i < store.size(); i++) {
if (store[i]->getType() == "Mall") {
nr = 0;
cout << "Products Sold in MiniMarkets ";
for(int i = 0; i<store.size(); i++){
if(store[i]->getType() == "MiniMarket"){
for(int j = 0; j < store[i]->getBuyersSize(); j++){
for(int h = 0; h < store[i]->getProductsSize(); h++){
if(store[i]->getBuyers(j).getProduct() == store[i]-
>getProducts(h).getName())
nr++;
}
}
}
}
cout << nr << endl;
nr = 0;
cout << "Products Sold in Markets ";
for(int i = 0; i<store.size(); i++){
if(store[i]->getType() == "Market"){
for(int j = 0; j < store[i]->getBuyersSize(); j++){
for(int h = 0; h < store[i]->getProductsSize(); h++){
if(store[i]->getBuyers(j).getProduct() == store[i]-
>getProducts(h).getName())
nr++;
}
}
}
}
cout << nr << endl;
nr = 0;
cout << "Products Sold in SuperMarkets ";
for(int i = 0; i<store.size(); i++){
if(store[i]->getType() == "SuperMarket"){
for(int j = 0; j < store[i]->getBuyersSize(); j++){
for(int h = 0; h < store[i]->getProductsSize(); h++){
if(store[i]->getBuyers(j).getProduct() == store[i]-
>getProducts(h).getName())
nr++;
}
}
}
}
cout << nr << endl;
nr = 0;
cout << "Products Sold in Malls ";
for(int i = 0; i<store.size(); i++){
if(store[i]->getType() == "Mall"){
for(int j = 0; j < store[i]->getBuyersSize(); j++){
for(int h = 0; h < store[i]->getProductsSize(); h++){
if(store[i]->getBuyers(j).getProduct() == store[i]-
>getProducts(h).getName())
nr++;
}
}
}
}
cout << nr << endl;
return 0;
}