Question
The base of the Traffic Cone is 16 square and 1 thick. The cone is hollow and its walls are 1 thick. Assume it is
The total amount of plastic needed will be the volume of the base plus the volume of the hollow cone. The volume of a cone is: V = (PI * r2 * h)/3
You will calculate the volume of the cone walls by subtracting the volume of the hollowed-out part (the inner wall of the cone) from the volume at the outer walls of the cone. |
Write a C++ program that calculates the volume of plastic required to cast one or more cones.
height = 28'', base = 16'', base hieght =2''
You will need to find the volume in cubic inches and in gallons. Remember, there are 231 cubic inches in a gallon. Remember to round up to the next gallon, since you cant buy a fraction of a gallon of paint. Therefore, the number of gallons to buy will be a int.
Begin the program by writing a header to the screen using cout. This will contain your name, the program title and objective. Present some explanation for the program. Then, declare the variables needed for your calculations.
The height and the base side length of the traffic cone and pi are constants and should be declared as such in your program. You may use #define or the const declaration.
Ask the user how many cones he/she wants to buy. Use cout and cin for this. Then calculate the volume to cast one cone and multiply by the number of cones.
Finally, your program will write out:
- The dimensions of the traffic cone, including height, base side length, and the inner and outer diameters of the cone.
- How many cones were ordered.
- The volumes of the base, the outer cone and the inner cone, all in cubic inches
- The volume of plastic needed for the cone walls
- The total volume of plastic needed in cubic inches
- The total volume of plastic needed in gallons (decimal).
- The total number of gallons to be ordered (int)
Format your output so that it is neat and table-like. You may want to refer to pages 73-78 for formatting help. Some of your variables will be integers and some will be floating point numbers. Set the precision so that you show 2 decimal places. Be sure to always show the units of your calculations.
Step 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