Java Reference
In-Depth Information
(The box problem) You have been given a flat cardboard of area, say,
70 square inches, to make an open box by cutting a square from each
corner and folding the sides (see Figure 7-17). Your objective is to
determine the dimension, that is, the length and width, and the side of
the square to be cut from the corners so that the resulting box is of
maximum volume.
21.
z
z
z
x
y
x
y
x
y
FIGURE 7-17 Cardboard box
7
Write a program that prompts the user to enter the area of the flat cardboard.
The program then outputs the length and width of the cardboard and the
length of the side of the square to be cut from the corner so that the resulting
box is of maximum volume. Calculate your answer to three decimal places.
Your program must contain a method that takes as input the length and
width of the cardboard and returns the side of the square that should be cut
to maximize the volume. The method also returns the maximum volume.
(The Power Station Problem) A power station is on one side of a river
that is one-half miles wide, and a factory is 8 miles downstream on the other
side of the river (see Figure 7-18). It costs $7 per foot to run power lines
22.
1/2 mile
y miles
x miles
8 miles
FIGURE 7-18 Power station, river, and factory
Search WWH ::




Custom Search