

//*****************************************************************************
////  Course:             COMS 2104 03 Foundations of Computer Programming I
////  Semester:           Spring 2004
////  Assignment Number:  #3                             
////  Author Name:        DarC KonQuesT                        
////  Date Written:       February 19, 2004
////                                                         
////  Description of Program:                              
////  Calculates bill for specific number of items at a given price.  Taking    
////  into account wholesale or retail price.                             
////*****************************************************************************
#include <iostream>
#include <iomanip>

const float TAX = 0.08;

using namespace std;

  int main()
  {
cout.setf(ios::fixed, ios::floatfield);
cout.setf(ios::showpoint);
cout << setprecision(2);

	char saletype;
	float price, subtotal, total;
	int number;
	cout << "Enter unit price: $";
	cin >> price;
	cout << endl << "Enter number purchased: ";
	cin >> number;
	cout << endl << "Type W if this is a wholesale purchase" << endl << "Type R if this is a retail purchase" << endl << "Then press enter/return" << endl;
	cin >> saletype;
	switch(saletype)
	{
	case 'w': case 'W':
	total = price * number;
		break;
	case 'r': case 'R':
	subtotal = price * number;
	total = (subtotal * TAX) + subtotal;
		break;
	default:
	cout << "Invalid Input." << endl;
		break;
		return 1;
	}
cout << number << " items at $" << price << endl;
cout << "Total bill is $" << total << endl;
	return 0;
  }


