Wednesday, July 7, 2010

// input: boxWeight in ounces
// output: boxWeight in metric tons
// output: how many boxes in 1 metric ton

int main()
{
    double boxWeight;
    double bwInMetricTons;
    int numBoxes;
    char ch;
do
{
    cout << "please enter box weight in oz.\n";
    cin >> boxWeight;

    // transform boxWeight into bwInMetricTons
    bwInMetricTons = boxWeight * (1/35273.962);
    numBoxes = 35,273.962 / boxWeight;

    cout << "In metric tons, this is "<< endl;
    cout << "The total # boxes in a metric ton is " << numBoxes << endl;

    cout << "Would you like to calculate again?";
    cin >> ch;
} while (ch == 'y' || ch == 'Y');
    return 0;
}

// 1 mt =  35,273.962 oz
// 1 oz = 1/

// 35,273.962 / boxWeight

No comments:

Post a Comment