//******************************************************************
// Walk program
// This program computes the mileage (rounded to tenths of a mile)
// for each of four distances between points in a city, given
// the measurements on a map with a scale of one inch equal to
// one quarter of a mile
//******************************************************************
#include <iostream>
#include <iomanip>    // For setprecision()

using namespace std;

const float DISTANCE1 = 1.5;      // Measurement for first distance
const float DISTANCE2 = 2.3;      // Measurement for second distance
const float DISTANCE3 = 5.9;      // Measurement for third distance
const float DISTANCE4 = 4.0;      // Measurement for fourth distance
const float SCALE = 0.25;         // Map scale (miles per inch)

int main()
{
    float totMiles;        // Total of rounded mileages
    float miles;           // An individual rounded mileage

    cout << fixed << showpoint               // Set up floating pt.
         << setprecision(1);                 //   output format

    // Initialize the total miles

    totMiles = 0.0;

    // Compute miles for each distance on the map

    miles = float(int(DISTANCE1 * SCALE * 10.0 + 0.5)) / 10.0;
    cout << "For a measurement of " << DISTANCE1
         << " the first distance is " << miles << " mile(s) long."
         << endl;
    totMiles = totMiles + miles;

    miles = float(int(DISTANCE2 * SCALE * 10.0 + 0.5)) / 10.0;
    cout << "For a measurement of " << DISTANCE2
         << " the second distance is " << miles << " mile(s) long."
         << endl;
    totMiles = totMiles + miles;

    miles = float(int(DISTANCE3 * SCALE * 10.0 + 0.5)) / 10.0;
    cout << "For a measurement of " << DISTANCE3
         << " the third distance is " << miles << " mile(s) long."
         << endl;
    totMiles = totMiles + miles;

    miles = float(int(DISTANCE4 * SCALE * 10.0 + 0.5)) / 10.0;
    cout << "For a measurement of " << DISTANCE4
         << " the fourth distance is " << miles << " mile(s) long."
         << endl;
    totMiles = totMiles + miles;

    // Print the total miles

    cout << endl;
    cout << "Total mileage for the day is " << totMiles << " miles."
         << endl;
    return 0;
}
