|
Power Station Problem
I need help on a homework assignment.
Let's say we have a power station on one side of a river and a factory on the other side of the river. For this example, we will say the river is half a mile wide, and the factory is 8 miles downstream from the power station. We'll also say it costs $9 to run power lines underwater, and $7 to run them overland. My 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.
THEN I need to create a program that will prompt the user to enter:
- the width of the river
- the distance of the factory downstream on the other side of the river
- the cost of laying the power line underwater
- the cost of laying the power line overland
The program should then output the length of the power line that should be run underwater, the length overland, and the total cost of constructing the power line.
I've been working my brain at this one all day and I just can't anymore. Can anyone help me?
|