Electrical and Computer Engineering
52 of 52
UAH
CPE 112
Cone Paint Program Concluded
•       // Compute cost for each color
•    redCost = surfaceArea * RED_PRICE;
•    blueCost = surfaceArea * BLUE_PRICE;
•    greenCost = surfaceArea * GREEN_PRICE;
•
•    // Print results
•    cout << setprecision(3);
•    cout << "The surface area is " << surfaceArea << " sq. ft."
•         << endl;
•    cout << "The painting cost for" << endl << "   red is";
•    cout << setw(8) << redCost << " dollars" << endl;
•    cout << "   blue is" << setw(7) << blueCost << " dollars"
•         << endl;
•    cout << "   green is" << setw(6) << greenCost << " dollars"
•         << endl;
•    return 0;
•}
•