Programs don't come out of nowhere, they come from the analysis of the problems that you are trying to solve. No matter if it's finding the year when the balance will double or laying a pattern with black and white tiles. Now suppose we have the algorithm and have tested with simple inputs. What's next?
B. Watch... (Slides)
PhoneCharge.java is here. Copy and paste main( ) to your own class and run it. Change minutes to a value of less than 300 and run it again.