Hi all,
I don't know how to use vectors to get the total number of amounts it should be in double.
this method is in one of the two classes, and it should count the total amounts that are in the other class (Aggregation) using vectors and return the total in double.
I don't really know how the total is done using vectors I just know how to do it using array lists.
here is what I meant and my solution

not all methods are there just the methods related to my problem are added)
I hope you help me please.
class Coffee
private String CoffeeName;//coffee name
private Vector mybatch;//vector of batches
double getTotalStock()
{ //NOT SURE
//calculate the total amount
for(int i =0;i<mybatch.size();i++)
Batch total += (Batch)mybatch.elementAt(i).getStock();
//here I guess the type is a class and the way to get the total is wrong how to get the value in double???
}
class Batch
{
private double stock;
public Batch(double stock)
{ //Done
//intialize new batch with stock
stock = stock;
}
public double getStock()
{
return stock; }
}
thank you