/*	Program:  ~cs35/first_if.cpp					9/13/01
	Purpose:	To have you write your first "if" statements
*/

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

int main ( )
{
 	int number;
 	double cost, handling, total;
 	int field_width;

	cout.setf(ios::fixed);
	cout.setf(ios::showpoint);
	cout.precision (2);
   
	cout << endl << "Welcome to E-CD, the electronic way to buy CD's." << endl;
	cout << "CD's are $5.00 each, ";
	cout << "with a $2.50 handling charge for orders under $13.00.\n" << endl;
	cout << "How many CD's would you like to order? ";
	cin  >> number;

	cost = number* 5;
    if (cost < 13)
    {
    	handling = 2.50;
    }
    else
    {
    	handling = 0;
    }
    
    total = cost + handling;
// Add some code that evaluates the handling charge and the total

	
	cout << "Your bill for "<<number<< " CDs will be : " <<total<<endl;
	
	field_width = 5;

	cout << "CDs:      "<<setw(5)<< cost<<endl;
		
	cout << "Handling: "<<setw(5)<< handling << endl;
		
	cout << "Total:    "<<setw(5)<< total << endl;
		
	cout << endl;
	cout <<"Thanks for shopping with us." << endl;
	return 0;
}
   
/*
	1) At line 25, add the code for handling charge and total
	2) Fix the output {presently line 29} so that it's correct if only 1 CD is ordered.
	3) {Very optional}  If your order is more than 20 CD's, the alignment of the output
		will be incorrect. use the "field-width" variable creatively, to change the 
		alignment when orders are $100 or more
*/

