I made this class but I cannot find a way to make the test class and implement the methods I used.
public class Battery
{
private float fullCharge = 3000;
private float batteryCapacity;
public Battery (float capacity)
{
if(capacity >0)
batteryCapacity = capacity;
fullCharge = capacity;
}
public void drain (float amount)
{
batteryCapacity = batteryCapacity -= amount;
}
public void charge (float amount)
{
batteryCapacity = fullCharge;
}
public float getRemainingCapacity()
{
return batteryCapacity;
}
}