Java Reference
In-Depth Information
overland and $9 per foot to run them underwater. Your objective is to
determine the most economical path to lay the power line. That is, determine
how long the power line should run underwater and how long it should run
over land, to achieve the minimum total cost of laying the power line.
Write a program that prompts the user to enter the following:
a. The width of the river.
b. The distance of the factory downstream on the other side of the river.
c. Cost of laying the power line underwater.
d. Cost of laying the power line overland.
The program then outputs the length of the power line that should run
underwater and the length that should run over land, so the cost of constructing
the power line is at the minimum. The program should also output the total
cost of constructing the power line.
(Pipe Problem, requires trigonometry) A pipe is to be carried around
the right-angled corner of two intersecting corridors. Suppose that the
widths of the two intersecting corridors are 5 feet and 8 feet (see Figure 7-19).
Your objective is to find the length of the longest pipe, rounded to the nearest
foot, that can be carried level around the right-angled corner.
23.
C
5
l
B
A
8
FIGURE 7-19 Pipe problem
Write a program that prompts the user to input the widths of both the
hallways. The program then outputs the length of the longest pipe, rounded
to the nearest foot, that can be carried level around the right-angled corner.
(Note that the length of the pipe is given by l ¼ AB + BC ¼ 8/sin y +5/
cos y, where 0 < y < p/2.)
 
Search WWH ::




Custom Search