//Sam Partovi CS1A Chapter 3, P. 144, #6
//
/*******************************************************************************
*
* CALCULATE WIDGET COUNT
* ____________________________________________________________
* This program calculates the number of widgets stacked on a pallet with a
* given widget weight, as well as the weight of the pallet with and without
* carrying the widgets.
*
* The calculation is based on the following formula:
* widgetCount = ( loadedPalletWeight - rawPalletWeight ) / widgetWeight
* ____________________________________________________________
*INPUT
* widgetWeight : Weight (lbs) of each widget
* rawPalletWeight : Weight (lbs) of the unloaded pallet
* loadedPalletWeight : Weight (lbs) of the pallet carrying widgets
*OUTPUT
* widgetCount : Number of widgets held on the pallet
*
******************************************************************************/
#include <iostream>
#include <string>
using namespace std;
int main() {
float rawPalletWeight; //INPUT - Weight (lbs) of the unloaded pallet
float loadedPalletWeight; //INPUT - Weight (lbs) of the pallet carrying widgets
int widgetCount; //Number of widgets held on the pallet
//Initialize program variable
const float widgetWeight = 9.2; //INPUT - Weight (lbs) of each widget
//Prompt user for pallet weight variables
cout << "Enter the raw pallet weight: ";
cin >> rawPalletWeight;
cout << "\nEnter the loaded pallet weight: ";
cin >> loadedPalletWeight;
//Perform calulcation of widgetCount
widgetCount = (loadedPalletWeight - rawPalletWeight) / widgetWeight;
//Display number of widgets
cout << "\nAt " << widgetWeight << " pounds per widget, the pallet is carrying "
<< widgetCount << " widgets.\n";
return 0;
}