// ~cs35/quiz4-01.cpp

#include "CS35lib.h"

const double TOFU_COST = 1.25;
const int WHEAT_JUICE_COST = 1.50;

double calculate_bill (double tofu, int bottle)
{
	double bill;
	bill = TOFU_COST * tofu + WHEAT_JUICE_COST*bottle;
	if (bill > 10)
	{
		bill = bill -1 ;
	}
	return bill;
}


int main ()
{
   

	double tofu_1, tofu_2, bill_1, bill_2;
	int bottles_1, bottles_2;

	set_decimal(2);
	
	cout <<"This program computes your co-op bill.\n";
	cout <<"Tofu is $"<<TOFU_COST<<" per pound; wheat juice is $"
				<<WHEAT_JUICE_COST<<" per bottle.\n";
	cout <<"A discount of $1.00 is given for any order over $10.\n";

	cout <<endl;
	cout <<"Shopper 1, enter your order in pounds and bottles: ";
	cin  >> tofu_1 >> bottles_1;
	cout <<"Shopper 2, enter your order in pounds and bottles: ";
	cin  >> tofu_2 >> bottles_2;

	bill_1 = calculate_bill (tofu_1,bottle_1);
	
	bill_2 = calculate_bill (tofu_2,bottle_2);
	
	cout << endl;
	cout << "Shopper 1, your bill is $"<<setw(5)<<bill_1<<endl;
	cout << "Shopper 2, your bill is $"<<setw(5)<<bill_2<<endl;
	return 0;
}






/*
bash-2.05$ ./a.out
This program computes your co-op bill.
Tofu is $1.25 per pound; wheat juice is $1.50 per bottle.
A discount of $1.00 is given for any order over $10.

Shopper 1, enter your order in pounds and bottles: 2.5  10
Shopper 2, enter your order in pounds and bottles: 1.5  3
Shopper 1, your bill is $17.12
Shopper 2, your bill is $6.38
bash-2.05$ c++ quiz4-01.cpp
bash-2.05$ ./a.out

This program computes your co-op bill.
Tofu is $1.25 per pound; wheat juice is $1.50 per bottle.
A discount of $1.00 is given for any order over $10.

Shopper 1, enter your order in pounds and bottles: 2.5  10
Shopper 2, enter your order in pounds and bottles: 1.0  3

Shopper 1, your bill is $17.12
Shopper 2, your bill is $ 5.75

bash-2.05$
*/	
	
	
