Dimensions of a Can of Soup

From CompSciWiki
Revision as of 13:20, 1 April 2010 by TylerD (Talk | contribs)

Jump to: navigation, search

Back to the Program-A-Day homepage

Problem

Your best friend rummages through your cupboards and emerges with a can of clam chowder. Being slightly obsessive about measuring objects, your friend concludes that the radius of the can is 4 centimeters and the height is 12 centimeters. Your friend then poses some questions to you:

  1. What is the surface area of the can?
  2. What is the volume of the can?
  3. Can I eat this clam chowder?

Design a program that finds answers to these questions. Make sure to use constants for values that do not change. Round all answers to the nearest integer value.

 

SideSectionTitle

float
Taken from http://www.flickr.com/photos/daniello/565304023/

An image or By Students section

Solution

An effective solution to this problem involves figuring out that there are a few constant values

Code

Solution Code

Back to the Program-A-Day homepage