So I have an arrayList
Dog spot = new Dog("Spot", "Lab","Blonde", Tail.OTTER,"Yes", 50, 3);
Dog buddy = new Dog("Buddy", "Pit Bull", "Black", Tail.DOCKED,"Yes", 60, 2);
Dog mia = new Dog ("Mia", "Pug", "Brown", Tail.RING ,"No", 70, 4);
Now the 50,60,and 70 are the weight of the dogs. I'd like to total them up without writing out lengthy, non flexible code such like:
int totalWeight = spot.weight + buddy.weight + mia.weight;
Is there a way to do that?