Lesson A8 - Control Structures |
|
|
Check Mail Background: The U.S. post office has rules about mailing packages. A package cannot be mailed first class if the sum of its length and girth is greater than 100 inches, or if the package weighs more than 70 pounds. The girth is the perimeter around the height and width, where the length is defined as the longest of the three dimensions. Assignment: Write a program that takes in the weight of the package and the three dimensions of the package in any order. The program should determine the longest dimension of the package, calculate the girth, and compute the size of the box. The program should then print out one of the following messages about this package:
Let’s look at how to design this class. Stepwise refinement 1 - Overall sections of this problem:
Stepwise refinement 2 - More detailed pseudocode version:
Stepwise refinement 3 - Determining longest of three dimensions:
|
|