///////
//
// Student: Russell Lowke
//     T.F: Francis Crick
// Unit Three, pencil-and-paper - question 2 [worth 2pts],  7/6/2002
//
//  Write a switch statement to determine the postage rate for sending an item,
//  given the weight in ounces (16 ounces = 1 pound), and the kind of mail class
//
	
	switch (postalClass) {
		case 1: // First class, domestic
			for (i = 1; i <= weight; i++) {  	 // loop through ounces
		 		if (i == 1)
		 			cost += 0.34;                // first ounce only
		 		else
		 			cost += 0.21;                // each additional ounce
			}
			break;
		case 2: // Foreign airmail
			cost = (weight / 2) * 0.50;          // $0.50 for each half-ounce
			break;
		case 3: // Postcards, domestic
			cost = 0.20;
			break;
		default: // Book rate
			weight = weight / 16;                // convert weight to pounds
			i = 1;                               // initialize i counter
			do {
				if (i == 1)
					cost += 1.05;
				else if (i >= 2 && i <= 6)
					cost += 0.43;
				else
					cost += 0.23;
			
				i++;
			} while (i <= weight);
	}
	
	cout << "cost: $" << cost << endl;
