This is the source file for the Cleaners2 project

Header File: Order.h

#if !defined CLEANINGORDER_H_
#define CLEANINGORDER_H_

class CleaningOrder
{
public:
	CleaningOrder();
	CleaningOrder(int s, int p, int o);
	~CleaningOrder();

private:
	int    NumberOfShirts;
	int    NumberOfPants;
	int    NumberOfOtherItems;
	double PriceShirt;
	double PricePants;

public:
	void setNumberOfShirts(const int n);
	int  getNumberOfShirts() const;
	void setNumberOfPants(const int n);
	int  getNumberOfPants() const;
	void setNumberOfOtherItems(const int n);
	int  getNumberOfOtherItems() const;

	void   setPriceShirt(const double p) { PriceShirt = p; }
	double getPriceShirt() const { return PriceShirt; }
	void   setPricePants(const double p) { PricePants = p; }
	double getPricePants() const { return PricePants; }

	double TotalOtherItems;

	double CalcPriceShirts() const;
	double CalcPricePants() const;
	void   CalcPriceOtherItems(int n);
	double CalcTotalOrder() const;
};

#endif // CLEANINGORDER_H_

Source File: Order.cpp

#include <iostream>
#include <iomanip>
using namespace std;

#include "Orders.h"

CleaningOrder::CleaningOrder()
	: NumberOfShirts(0), NumberOfPants(0),
	  NumberOfOtherItems(0), PriceShirt(0.95),
	  PricePants(1.75)
{
	
}

CleaningOrder::CleaningOrder(int Shirts, int Pants,
							 int Others)
	: NumberOfShirts(Shirts), NumberOfPants(Pants),
	  NumberOfOtherItems(Others), PriceShirt(0.95),
	  PricePants(1.75)
{
	
}

CleaningOrder::~CleaningOrder()
{
}

void CleaningOrder::setNumberOfShirts(const int n)
{
	NumberOfShirts = (n <= 0 ) ? 0 : n;
}

int  CleaningOrder::getNumberOfShirts() const
{
	return (NumberOfShirts <= 0 ? 0.00 : NumberOfShirts);
}

void CleaningOrder::setNumberOfPants(const int n)
{
	NumberOfPants = (n <= 0) ? 0 : n;
}

int  CleaningOrder::getNumberOfPants() const
{
	return (NumberOfPants <= 0 ? 0.00 : NumberOfPants);
}

void CleaningOrder::setNumberOfOtherItems(const int n)
{
	NumberOfOtherItems = (n <= 0 ? 0 : n); 
}

int  CleaningOrder::getNumberOfOtherItems() const
{
	return (NumberOfOtherItems <= 0 ? 0.00 : NumberOfOtherItems);
}

double CleaningOrder::CalcPriceShirts() const
{
	return NumberOfShirts * PriceShirt;
}

double CleaningOrder::CalcPricePants() const
{
	return NumberOfPants * PricePants;
}

void CleaningOrder::CalcPriceOtherItems(int n)
{
	if( n > 0 )
	{
		double Sum = 0, P;
		
		cout << "\nEnter the price for each misc item\n";
		for(int i = 0; i < n; ++i)
		{
			cout << "Price for item " << i + 1 << ": $";
			cin >> P;
			Sum += P;
		}
		TotalOtherItems = Sum;
	}
	else
		TotalOtherItems = 0.00;
}

double CleaningOrder::CalcTotalOrder() const
{
	return CalcPriceShirts() + CalcPricePants() + TotalOtherItems;
}

Source File: Main.cpp

#include <iostream>
#include <iomanip>
using namespace std;

#include "Orders.h"

void ProcessOrder(CleaningOrder& Order)
{
	int QtyShirts, QtyPants, QtyOthers;

	// Get the number of items
	cout << "How many shirts? ";
	cin >> QtyShirts;
	cout << "How many Pants? ";
	cin >> QtyPants;
	cout << "How many other items? ";
	cin >> QtyOthers;

	Order.CalcPriceOtherItems(QtyOthers);
	Order.setNumberOfShirts(QtyShirts);
	Order.setNumberOfPants(QtyPants);
	Order.setNumberOfOtherItems(QtyOthers);
	Order.setPriceShirt(0.95);
	Order.setPricePants(1.75);
}

int main()
{
	CleaningOrder Order;
	void DisplayReceipt(const CleaningOrder& O);

	ProcessOrder(Order);
	DisplayReceipt(Order);

	cout << "\n\n";
	return 0;
}

void DisplayReceipt(const CleaningOrder& Order)
{
	cout << setiosflags(ios::fixed) << setprecision(2);
	// Display the receipt
	cout << "\n======================================="
	     << "\nGeorgetown Cleaning Services - Receipt"
	     << "\n---------------------------------------"
	     << "\nQty\tItem\tUnit\tSub-Total"
             << "\n" << Order.getNumberOfShirts() << "\tShirts\t$"
             << Order.getPriceShirt() << "\t$" << Order.CalcPriceShirts()
	     << "\n" << Order.getNumberOfPants() << "\tPants\t$"
	     << Order.getPricePants() << "\t$" << Order.CalcPricePants()
             << "\n" << Order.getNumberOfOtherItems() << "\tOthers\t"
	     << "Vary\t$" << Order.TotalOtherItems
             << "\n---------------------------------------"
             << "\n\tTotal Order: $" << Order.CalcTotalOrder()
	     << "\n=======================================";
}