capacity pancakes at a time. Using this pan you must cook
numCakes pancakes. Each pancake must be cooked for five
minutes on each side, and once a pancake starts cooking on a side it has
to cook for five minutes on that side. However, you can take a pancake
out of the pan when you're ready to flip it after five minutes and put
it back in the pan later to cook it on the other side.
Write the method, minutesNeeded, that returns the shortest
time needed to cook numCakes pancakes in a pan that holds
capacity pancakes at once. See the examples.
numCakes is a non-negative number less than 1000
(i.e., 0 ≤ numCakes < 1000).
capacity is a positive number less than 100
(i.e., 1 ≤ capacity < 100).
numCakes = 0 capacity = 4 Returns: 0It takes no time to cook 0 pancakes.
numCakes = 2 capacity = 2 Returns: 10You cook both pancakes on one side for five minutes, then flip them over and cook each on the other side for another five minutes.
numCakes = 3 capacity = 2 Returns: 15You cook pancakes 1 and 2 on one side for five minutes, then you take pancake 2 out of the pan, flip pancake 1 and start cooking pancake 3. After 10 minutes, pancake 1 is done so you take it out, pancake 3 can be flipped, and you can put pancake 2 back in the pan (since you removed the first pancake). Total time: 15 minutes.
