Program General Description:
Write a program that receives input in groups of 2 to determine the amount of material to produce various sizes of cans and determine how many cans can be made from an amount of material.
The basic program: 85%
The program will print out the program name and description of what the program will do. The program will then prompt for 3 pairs of data:
height of a can, in cm
radius of the can, in cm
The program will ask for the dimensions for 3 cans.
After receiving the height and radius for 1 can, the program will print out the surface area of that can in sq cm.
After the last can’s surface area is printed, the program will prompt for an amount of material to make cans (in sq cm).
The program will then determine how many of each type of can can be made from the material.
Technical details:
formula for the surface area of a cylinder is to the right
follow conventions taught in class
has comments
will only use material listed in class notes
neatness, creativity for the interface/interaction counts
(ie simple to use, minimum typing, clear output)
assume the user always enters valid input – do not worry about errors if user enters invalid values
any internal calculated values must use all the decimal values as calculated (ie not rounded)
any displayed numbers must be rounded to 1 decimal place, where appropriate
no decimals for the calculated number of cans
use 3.1416 as pi
Example Output (note: this display would not receive full marks):
Enter height (cm) : 8.5
Enter radius (cm) : 5
One can needs : 424.1 sq cm
:
Enter Amount of Material (cm
2
) : 100000
:
For first dimensions: 235 cans can be made
:
Next Additional: 10%
The program will accept any number of cans (ie not limited to 3).
The program will also, for each type of can, calculate
One crate can hold 600 cans.
Final Additional : 5%
The program will calculate the
minimum number
of the different types of cans that can fit into one crate using the following algorithm:
assuming there are n types of cans, then one group of cans consists of :
n of the cans with the largest surface area
n – 1 of the cans with the next largest surface are
:
1 of the can with the smallest surface area
determine how many of these
whole groups
can fit in a crate
print out the resulting number of cans of each type of can.
Note: You do not need to write your own sort function.