//Written by mark lair
//Sept 9, 2007
//Chapter 4
//Assignment 10, Software  sales 

//this program will calculate software 
//Sales based on quantity  discounts

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{

//define constants and variables

	const double SYSPRICE = 99.00;
	int numordered;
	double discount = 0.00;
	double pretotal;
	double totalcost;

//collect order information 

	cout << "Enter the number of software packages you would like to order:" << endl;
	cin >> numordered;

//calculate discount and total cost

	if (numordered < 1)
	{
		discount = 1;
		cout<<"You did not order anything! Please re-run the program and try again."<<endl;
	}

	else if (numordered < 10)
	{
		discount = 1;
		cout<<"Orders of fewer than 10 are priced at full retail."<<endl;
	}

	else if (numordered < 20)
	{
		discount = .80;
		cout<<"Your discount is " << (1 - discount) * 100 << '%'<<endl;
	}

	else if (numordered < 50)
	{
		discount = .70;
		cout<<"Your discount is " << (1 - discount) * 100 << '%'<<endl;
	}

	else if (numordered < 100)
	{
		discount = .60;
		cout<<"Your discount is " << (1 - discount) * 100 << '%'<<endl;
	}

	else
	{
		discount = .50;
		cout<<"Your discount is " << (1 - discount) * 100 << '%'<<endl;
	}

	pretotal = (numordered * 99);
	totalcost = (pretotal * discount);
	cout<<setprecision(2)<<fixed<<"Your order including all discounts comes to $"<<totalcost<<endl;



	system("pause");
	return 0;
}

