(The power station problem) A power station is on one side of a river
that is one-half mile wide, and a factory is eight miles downstream on the
other side of the river (see Figure 7-21). It costs $7 per foot to run power
lines over land and $9 per foot to run them under water. Your objective is
to determine the most economical path to lay the power line. That is,
determine how long the power line should run under water 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:
a. The width of the river
b. The distance of the factory downstream on the other side of the river
c. The cost of laying the power line under water
d. The cost of laying the power line over land
The program then outputs the length of the power line that should run
under water 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.
Mark Kim Bryan 0 Newbie Poster
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.