A miner is looking for diamonds in an underground mine. He is standing in front of 7 tunnels. Only one of these tunnels lead him directly to the diamonds. Write a program that searches for diamonds in these tunnels. The program should accept whether there are diamonds in a particular tunnel or otherwise after the miner enters the tunnel. If the miner has found the diamonds, he need not search the remaining tunnels. The program should display the number of tunnels that the miner searched before finding the diamonds. Hint: To compare strings, use (String 1).equals(String 2).
Answers
Explanation:
miner is looking for diamonds in an underground mine. He is standing in front of 7 tunnels. Only one of these tunnels lead him directly to the diamonds. Write a program that searches for diamonds in these tunnels. The program should accept whether there are diamonds in a particular tunnel or otherwise after the miner enters the tunnel. If the miner has found the diamonds, he need not search the remaining tunnels. The program should display the number of tunnels that the miner searched before finding the diamonds. Hint: To compare strings, use (String 1).equals
Explanation:
Relatively costly and frequently used to get to deeper deposits, underground mining involves digging down into the earth and creating tunnels and shafts that reach the deposits of resources. Ore and other resources can then be brought up to the surface for processing, while waste rock can be removed for disposal.