Question

In: Computer Science

A manufacturer wishes to determine the cose of producing open-top cylindrical containers.


C language

A manufacturer wishes to determine the cose of producing open-top cylindrical containers. The surface area of the container is the sum of the area of the circular base plus the are of the outside the circumference of the base times the height of the container). Write a program to take the radius of the base, the height of the container, the cost per square centimeter of the material (cost), and the number of containers to be produced (quantity). Calculate the cost of each container and the total cost of producing all the containers. 


Program must include a function that displays the welcome message to the user and a function that computes surface area. Costs are to be rounded to hundreths (i.e. 2 decimal places) at output. 


Welcome Message: 

Cost Calculator 


Computes cost of materials to produce cylindrical containers.

Solutions

Expert Solution

#include

int welcome(){

printf(“Cost calculator\n”);

printf(“—————————“);

printf(“Computes cost of materials to produce cylindrical materials”);

return 0;} //welcome function ends

float surface(r,h){

#define pi = 3.1415

float area=2*pi*r*h+pi*r*r;

return area;} //surface function ends

int main(){

float r,h,c;

int n;

printf(“Enter the radius”);

scanf(“%f”,& r);

printf(“Enter the height”);

scanf(“%f”,&h);

printf(“Enter the cost per square centimetre of the material”);

scanf(“%f”,&c);

printf(“Enter the number of containers to be produced”);

scanf(“%d”,&n);

welcome(); // calling welcome function.

float surface_area=surface(r,h); //calling surface function and passing the values of radius and height.

float cost_per_container=surface_area*c; //calculating cost of each container.

float total_cost=cost_per_container*n; //calculating the total cost of all containers.

printf(“Cost of each container is %0.2f”,cost_per_container); //%0.2f will round off the cost to two decimal places.

printf(“Total cost of all container is %0.2f”,total_cost);

return 0;

}


Related Solutions

Two identical containers are open at the top and are connected at the bottom via a...
Two identical containers are open at the top and are connected at the bottom via a tube of negligible volume and a valve that is closed. Both containers are filled initially to the same height of 1.00 m, one with water, the other with mercury, as the drawing indicates. The valve is then opened. Water and mercury are immiscible. Determine the fluid level in the left container when equilibrium is reestablished.
An open-top cylindrical container is to have a volume of 729 cm3. What dimensions(radius and height)...
An open-top cylindrical container is to have a volume of 729 cm3. What dimensions(radius and height) will minimize the surface area?
A sunglasses manufacturer wishes to determine the minimum price it should charge a customer for a...
A sunglasses manufacturer wishes to determine the minimum price it should charge a customer for a special order of sunglasses. The customer has requested a quotation for 100 sunglasses (10 batches) but might subsequently place an order for an additional 100. Material costs are €25 per pair of sunglasses. It is estimated that the first batch of sunglasses will take 80 hours to be completed and a 70% learning curve would apply. Labour and variable overhead costs amount to €2....
Determine the force vs reduction in height curve in open-dye forging of a cylindrical, annealed copper...
Determine the force vs reduction in height curve in open-dye forging of a cylindrical, annealed copper specifmen 10mm high and 25mm in diameter, up to a reduction of 50% for the following cases: a) no friction between the flat dies and the specimen b) u=0.10 c) u=0.30 Ignore barreling and use average pressure formulas. Then, calculate the work done and the temperature rise in the specimen for each case, assuming the process is adiabatic and and the temperature is uniform...
A manufacturer of widgets wants to test a new widget-producing machine to determine if it can...
A manufacturer of widgets wants to test a new widget-producing machine to determine if it can make an average of 20 widgets per second before deciding to invest in the machine. The standard to reject the new machine is if it makes an average of less than 20 widgets per second. Here are data from a small random sample: 15.6, 16.2, 22.5, 20.5, 16.4, 19.4, 19.6, 17.9, 12.7, 14.9 Assuming the population follows a normal distribution, is there evidence that...
A cylindrical can is to be built to occupy a volume of 5000m3. The top and...
A cylindrical can is to be built to occupy a volume of 5000m3. The top and bottom of the cylinder cost $500/m2, wheras the cost to build the wall of the cylinder is $300/m2. Also, the top of the cylinder is to have a circular hole that will occupy 1/4 of the top area. Find the dimensions, to 2 decimal places, of the cylinder to minimize the cost. What is the cost, rounded to the nearest hundred, to build the...
A cylindrical container that has a capacity of 18 m3 is to be produced. The top...
A cylindrical container that has a capacity of 18 m3 is to be produced. The top and bottom of the container are to be made of a material that costs $25 per square meter, while the side of the container is to be made of a material costing $15 per square meter. Find the dimensions that will minimize the cost of the material. (Round your answers to three decimal places.)
A machine is producing metal pieces that are cylindrical in shape. A sample of 12 pieces...
A machine is producing metal pieces that are cylindrical in shape. A sample of 12 pieces is taken and the diameters are: 1.01, 0.97, 1.03, 1.04, 0.8, 0.78, 1.06, 0.95, 0.87,1.0,0.88 and 0.90 centimeters. a. Find 98% confidence interval for the true average diameter of metal pieces produced by the machine. We would like to test whether the true average diameter of metal pieces produced by the machine is less than 1 centimeter. b. Assuming the population distribution is approximately...
Derive the Friction Hill equation for open die forging of a cylindrical workpiece
Derive the Friction Hill equation for open die forging of a cylindrical workpiece
a cylindrical can without a top is made to contain 371 in^3 .what are the dimensions...
a cylindrical can without a top is made to contain 371 in^3 .what are the dimensions that will minimize the cost of production?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT