Question: I have an activity with launch mode as Single Task.The activity is launched by with intent flags Intent.FLAG\_ACTIVITY\_NEW\_TASK by a Broadcast receiver . If this activity is on top of home screen and if I call moveTasktoBack(true) from this activity, I expect the home screen to be shown however instead of home screen, Activity B from another task is brought in front. The sequence of operations is as follow. 

Activity B in TASK B -> [Press Home Button] -> Home Screen -> Launch Activity A by BroadCast Receiver -> Activity A calls moveTaskToBack(true) -> Activity B in Task B comes to foreground.

I have checked the Task Affinity of Task A (with activity A) and Task B (with activity B) and they are different. 

How can I make sure that in such a scenario, Home screen is shown when activity moves itself to back of stack.

Answer: 
You need just one single `road`:

```
int main()
{
    Road road;
    double inputWidth = 0.0, inputLength = 0.0, inputDepth = 0.0;

    cout << "Enter the width of the road in miles: ";
    cin  >> inputWidth;
    cout << endl;
    cout << "Enter the length of the road in miles: ";
    cin  >> inputLength;
    cout << endl;
    cout << "Enter the depth of the road in inches: ";
    cin  >> inputDepth;
    cout << endl;

    road.set_road_width(inputWidth);
    road.set_road_length(inputLength);
    road.set_road_depth(inputDepth);
    road.asphalt_required();

    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(2);

    cout << "The width of the road is: " << inputWidth << " mile(s)" << endl;
    cout << "The length of the road is: " << inputLength << " mile(s)" << endl;
    cout << "The depth of the road is: " << inputDepth << " inch(es)" << endl;
    cout << "Asphalt required: " << road.asphalt_required() << " cubic yard(s)" << endl;

    return 0;
}

```
You never do anything with `output` other than construct it and print its `asphalt_required()`. This is why it prints zero: you never actually modify `output` in any way!

Beyond that, you may want to think about why you construct so many `Road` instances. It seems like there should be only one. As it stands, you have five `Road`s: three are one-dimensional and two are zero-dimensional.