0

I'm trying to design a simple method, however the values aren't being calculated for some reason:

public static void animateBattery()
{
    float boxPercent = (58/100);
    System.out.println( "boxPercent "+ boxPercent);

    int batteryPercent = (int) Math.round(storageLimit / 100 * elecStored);
    setBatteryColor(batteryPercent);
    System.out.println( "batteryPercent "+ batteryPercent);

    int storedPercent = (int) Math.round(boxPercent * batteryPercent);
    System.out.println( "storedPercent "+ storedPercent);

    System.out.println( "Another demonstration " + 58/100);

    System.out.println( "One more " + 100);

    batteryColor.setBounds(890, 405 + (58 - storedPercent), 81, storedPercent);
    frame.getContentPane().add(batteryColor);
}

outputs:

boxPercent 0.0
batteryPercent 0
storedPercent 0
Another demonstration 0
One more 100

Hope I've provided enough code to go off. Apologies for being a noob. Any assistance with this would be greatly appreciated!

Uncle_Timothy
  • 91
  • 1
  • 8

0 Answers0