Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the cinema classic Die Hard With a Vengeance, Bruce Willis and Samuel L. Jackson are presented with a difficult challenge by Jeremy Irons.
In the cinema classic Die Hard With a Vengeance, Bruce Willis and Samuel L. Jackson are presented with a difficult challenge by Jeremy Irons. They are given a 3 gallon can, a 5 gallon can, and a fountain of water. Their goal is to have exactly 4 gallons of water left in the can. For this assignment, you will recreate this harrowing game using loops. You will present the user with the following options: 1. Fill the 5 gallon can from the fountain 2. Fill the 3 gallon can from the fountain 3. Pour the 5 gallon can into the 3 gallon jug 4. Pour the 3 gallon can into the 5 gallon jug 5. Empty the 5 gallon can into the fountain 6. Empty the 3 gallon can into the fountain You should then calculate the amount of water in each can and display it to the user. Note that if the 3 gallon can is full, option # 3 should have no effect. Likewise, if the 5 gallon can ful option #4 should have no effect. The game will end when there is exactly 4 gallons of water in the 5 gallon can. Sample Output: [4 Gallons of Water] The 3 gallon can has 0 gallons of water. The 5 gallon can has 0 gallons of water. Options 1) Fill the 5 gallon can from the fountain 2) Fill the 3 gallon can from the fountain 3) Pour the 5 gallon can into the 3 gallon jug 4) Pour the 3 gallon can into the 5 gallon jug 5) Empty the 5 gallon can into the fountain 6) Empty the 3 gallon can into the fountain What will you do? 1 The 3 gallon can has 0 gallons of water. The 5 gallon can has 5 gallons of water. Options 1) Fill the 5 gallon can from the fountain 2) Fill the 3 gallon can from the fountain 3) Pour the 5 gallon can into the 3 gallon jug 4) Pour the 3 gallon can into the 5 gallon jug 5) Empty the 5 gallon can into the fountain 6) Empty the 3 gallon can into the fountain What will you do? 3 The 3 gallon can has 3 gallons of water. The 5 gallon can has 2 gallons of water. In the cinema classic Die Hard With a Vengeance, Bruce Willis and Samuel L. Jackson are presented with a difficult challenge by Jeremy Irons. They are given a 3 gallon can, a 5 gallon can, and a fountain of water. Their goal is to have exactly 4 gallons of water left in the can. For this assignment, you will recreate this harrowing game using loops. You will present the user with the following options: 1. Fill the 5 gallon can from the fountain 2. Fill the 3 gallon can from the fountain 3. Pour the 5 gallon can into the 3 gallon jug 4. Pour the 3 gallon can into the 5 gallon jug 5. Empty the 5 gallon can into the fountain 6. Empty the 3 gallon can into the fountain You should then calculate the amount of water in each can and display it to the user. Note that if the 3 gallon can is full, option # 3 should have no effect. Likewise, if the 5 gallon can ful option #4 should have no effect. The game will end when there is exactly 4 gallons of water in the 5 gallon can. Sample Output: [4 Gallons of Water] The 3 gallon can has 0 gallons of water. The 5 gallon can has 0 gallons of water. Options 1) Fill the 5 gallon can from the fountain 2) Fill the 3 gallon can from the fountain 3) Pour the 5 gallon can into the 3 gallon jug 4) Pour the 3 gallon can into the 5 gallon jug 5) Empty the 5 gallon can into the fountain 6) Empty the 3 gallon can into the fountain What will you do? 1 The 3 gallon can has 0 gallons of water. The 5 gallon can has 5 gallons of water. Options 1) Fill the 5 gallon can from the fountain 2) Fill the 3 gallon can from the fountain 3) Pour the 5 gallon can into the 3 gallon jug 4) Pour the 3 gallon can into the 5 gallon jug 5) Empty the 5 gallon can into the fountain 6) Empty the 3 gallon can into the fountain What will you do? 3 The 3 gallon can has 3 gallons of water. The 5 gallon can has 2 gallons of water.
Step by Step Solution
★★★★★
3.37 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
Heres a Python program to recreate the water puzzle from Die Hard With a Vengeance using loops pytho...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started