Answer:
Step-by-step explanation:
The shortest time needed means that we are not taking into account the amount of time it takes to switch pancakes, flip them, or take them out of the pan, etc. Only cooking them. Therefore, written in Java would be the following...
public static int minutesNeeded (int numCakes, int panCapacity) {
int minutesNeededtoCook = 0;
while (numCakes != 0) {
if (numCakes > panCapacity) {
numCakes -= panCapacity;
minutesNeededtoCook += 10;
} else {
numCakes = 0;
minutesNeededtoCook += 10;
}
}
return minutesNeededtoCook;
}
The code takes in the amount of pancakes and the pan capacity, then compares them and adds 10 minutes (5 on each side) per pancake batch that is being made until all the pancakes are made.