Question: Goal: Use a while loop to perform a repetitive action Assignment: You are assisting in developing a minimalist RPG game where players can extract resources.

Goal: Use a while loop to perform a repetitive action
Assignment: You are assisting in developing a minimalist RPG game where players can extract resources. Based on the player's equipment, they will be able to extract the resources faster.
Task: Given the int variables toolEfficiency and resourceAmount, write a while loop that iterates until the value left in resourceAmount is 0 or less, by removing at each iteration an amount equal to toolEfficiency. At each iteration, print out the amount of resource left. For example, with a tool efficiency of 25, the output will be:
125
100
75
50
25
0
Note: Only write the lines to create a loop that decrements resourceAmounts and prints its value.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!