I cannot get this program to compile. It is bombing at the Outfit::Outfit constructor. I am getting an error stating that it is missing argument list and also illegal left operand type. Can someone point me in the right direction? Cheers - Jason

// Outfit class contains Dress and Shoes
// A 20% discount applies when you buy an entire outfit
#include<iostream>
#include<string>
using namespace std;
class Dress
{
  private:
   string material;
   int size;
   string style;
   double price;
  public:
    Dress(string = "cotton", int = 8, string = "daytime");
    void displayDress();
	double getPrice();
};
Dress::Dress(string mtrl, int sz, string stl)
{
  material = mtrl;
  size = sz;
  style = stl;
  price = 29.99;
  if(material == "silk")
    price += 20.00;
  if(style == "evening")
    price += 40.00;
}

void Dress::displayDress()
{
   cout<<"A size "<<size<<" dress made of "<<material<<
	   " and suitable for "<<style<<
	   " wear costs $"<<price<<endl;
}
double Dress::getPrice()
{
	return price;
}
class Shoes
{
  private:
	string material;
    int size;
    string style;
    double price;
  public:
    Shoes(string = "leather", int = 8, string = "casual");
    void displayShoes();
	double getPrice();
};
Shoes::Shoes(string mtrl, int sz, string stl)
{
  material = mtrl;
  size = sz;
  style = stl;
  price = 29.99;
  if(material == "suede")
    price += 20.00;
  if(style == "formal")
    price += 40.00;
}

void Shoes::displayShoes()
{
   cout<<"A pair of size "<<size<<" shoes made of "<<material<<
	   " and suitable for "<<style<<
	   " wear costs $"<<price<<endl;
}
double Shoes::getPrice()
{
	return price;
}
class Outfit
{
  private:
	Dress dress;
	Shoes shoes;
	double price;
  public:
	  static const double DISCOUNT;
	  Outfit(string, int, string, string, int, string);
	  void displayOutfit();
};
const double DISCOUNT = 0.20;

Outfit::Outfit(string m1, int sz1, string style1, string m2, int sz2, string style2) //:dress(m1, sz1, style1),shoes(m2, sz2, style2)
{
   price = dress.getPrice + shoes.getPrice;
   price = price - (price * DISCOUNT);
}
void Outfit::displayOutfit()
{
   dress.displayDress();
   shoes.displayShoes();
   cout<<"With "<<(DISCOUNT * 100)<<"% discount, outfit is "<<
		price<<endl;
}
int main()
{
    string dressMat, dressStyle, shoeMat, shoeStyle;
   int dressSize, shoeSize;
   cout<<"Enter dress material ";
   cin>>dressMat;
   cout<<"Enter dress size ";
   cin>>dressSize;
   cout<<"Enter dress syle ";
   cin>>dressStyle;
   cout<<"Enter shoe material ";
   cin>>shoeMat;
   cout<<"Enter shoe size ";
   cin>>shoeSize;
   cout<<"Enter shoe syle ";
   cin>>shoeStyle;
   Outfit completeOutfit(dressMat, dressSize, dressStyle, shoeMat, shoeSize, shoeStyle);
   completeOutfit.displayOutfit;
}

I fixed it. Case of being too close to it. The compilation errors that I was getting were exactly as they said. I was not passing arguments back to the class members to get the price of the "outfit"

Here's part of the solution. I had to make just a couple of changes elsewhere, but this is the gist of it:

class Outfit
{
  private:
	Dress dress;
	Shoes shoes;
	double price;

  public:
	  Outfit(string, int, string, string, int, string);
	  void displayOutfit();
	  static const double DISCOUNT;
	  
};

const double Outfit::DISCOUNT = 0.20;
Outfit::Outfit(string m1, int sz1, string style1, string m2, int sz2, string style2):dress(m1, sz1, style1),shoes(m2, sz2, style2)
{
	
  price = dress.getPrice(m1,sz1,style1) + shoes.getPrice(m2,sz2,style2);
  price = price - (price * DISCOUNT);
}
void Outfit::displayOutfit()
{
   dress.displayDress();
   shoes.displayShoes();
   cout<<"With "<<(DISCOUNT * 100)<<"% discount, outfit is "<<
		price<<endl;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.