// ~cs35/quiz6.cpp

#include "CS35lib.h"

const double COST_PER_CD = 2.50;

void calculate_bill(int CD, double& bill, double& shipping, double& total)
{
	bill = CD * COST_PER_CD;
	if (CD >=11)
	{
		shipping = 0.00;
	}
	else
	{
		shipping = 1.50;
	}
	total = bill + shipping;
}
void print_bill(int user, double bill, double shipping, double total)
{
	user = 0;
	user++;
	set_decimal(2);
	cout<<endl;
	cout<<setw(21)<<"Bill for customer "<<user<<"."<<endl;
	cout<<setw(21)<<"Bill for CD's : $ "<<bill<<endl;
	cout<<"   Shipping"<<setw(10)<<" : $ "<<shipping<<endl;
	cout<<"   Total"<<setw(13)<<" : $ "<<total<<endl;
}




int main ()
{
	int CD_1, CD_2;
	double bill_1, shipping_1, total_1, bill_2, shipping_2, total_2;
	
	cout <<"Customer 1, how many CD's would you like to order? (30 max) ";
	cin >> CD_1;
	
	cout <<"Customer 2, how many CD's would you like to order? (30 max) ";
	cin >> CD_2;
	
// Complete the next two lines
	calculate_bill (CD_1, bill_1, shipping_1, total_1);
	calculate_bill (CD_2, bill_2, shipping_2, total_2);
	
	print_bill (1, bill_1, shipping_1, total_1);
	print_bill (2, bill_2, shipping_2, total_2);
	return 0;
}
	
	
/*
bash-2.05$ ./a.out
Customer 1, how many CD's would you like to order? (30 max) 30
Customer 2, how many CD's would you like to order? (30 max) 3

Bill for customer 1:
Bill for CD's: $75.00
Shipping     : $ 0.00
Total        : $75.00

Bill for customer 2:
Bill for CD's: $ 7.50
Shipping     : $ 1.50
Total        : $ 9.00
bash-2.05$
*/	
	
