Write a Battery starting fully charged at 100. use takes off the given percentage but never below 0. charge adds but never above 100. getLevel returns the charge, and isEmpty returns whether it has reached 0.
class Battery { Battery(); void use(int amount); void charge(int amount); int getLevel(); boolean isEmpty(); }
Examples
There are also 3 hidden tests you can't see. Solve the problem, not the examples.