Difference between revisions of "Dimensions of a Can of Soup"

From CompSciWiki
Jump to: navigation, search
Line 1: Line 1:
 
{{1010PrAD|ProblemName=Dimensions of a Can of Soup
 
{{1010PrAD|ProblemName=Dimensions of a Can of Soup
  
|Problem= Your best friend in the whole world 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:
+
|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:
  
 
#What is the surface area of the can?
 
#What is the surface area of the can?
Line 7: Line 7:
 
#Can I eat this clam chowder?
 
#Can I eat this clam chowder?
  
Being slightly obsessive about using Java to do all of your mathematical computations, you design a program to find answers to these questions.
+
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.
 
+
  
 
|SideSection=
 
|SideSection=

Revision as of 13:20, 1 April 2010

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