Electrical and Computer Engineering
6 of 29
UAH
CPE 112
An Example Program
Using Files
• // Compute surface area of the cone
•
•    surfaceArea = PI * radius *
•                  sqrt(radius*radius + heightInFt*heightInFt);
• 
•    // Compute cost for each color
• 
•    redCost = surfaceArea * redPrice;
•    blueCost = surfaceArea * bluePrice;
•    greenCost = surfaceArea * greenPrice;
• 
•
•
•