Question
(C++) Create another program using this program as C++ expressions. #include // include header files needed using namespace std; int main() { Declare the Height
(C++) Create another program using this program as C++ expressions.
#include // include header files needed
using namespace std;
int main()
{
Declare the Height of a typical cone as constant, give it the value 30 inches
Declare the diameter of base of cone as constant, give it the value 8 inches
Declare RED_PRICE,the Price per square foot of red paint, as constant give it the value 0.10
Declare BLUE_PRICE, the Price per square foot of blue paint, as constant give it the value 0.15
Declare GREEN_PRICE, the Price per square foot of green paint, as constant give it the value 0.18
Declare PI as a constant with value 3.14159265 // Ratio of circumference to diameter
Declare INCHES_PER_FT as a constant with value 12.0; // Inches in 1 foot
float heightInFt; // Height of the cone in feet
float diamInFt; // Diameter of the cone in feet
float radius; // Radius of the cone in feet
float surfaceArea; // Surface area in square feet
float redCost; // Cost to paint a cone red
float blueCost; // Cost to paint a cone blue
float greenCost; // Cost to paint a cone green
cout
// Find radius and convert dimensions, that in inches, to feet. MAKE SURE YOU //USE CONSTANT INCHES_PER_FT
-----------------????
// Compute surface area of the cone
//surfaceArea = * (
------------------???
// Compute cost for each color
redCost = surfaceArea * RED_PRICE;
blueCost = surfaceArea * BLUE_PRICE;
greenCost = surfaceArea * GREEN_PRICE;
// Print results
cout
cout
cout
.
return 0;
}
- You must insert the correct formulas as C++ expressions
- Convert dimensions of cones given in inches to feet
- Compute the surface area of the cone
- Compute the cost for each of the color(surfaceArea multiplied by PRICE of each color as shown above)
- Make sure that you Set up floating point output format and that the results (cost per square foot of each of the paints) are be printed to 3 decimal points as shown below:
(C++)
C:\Windows\system32\cmd.exe The surface area is 2.641 sq. ft. The painting cost for red is 0.264 dollars blue is 0.396 dollars green is 0.475 dollars Press any key to continueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started