class Rock {
  private final double weight;
  public Rock(double weight) {
    this.weight = weight;
  }
  public double getWeight() {
    return weight;
  }
}
public class Main {
  public static void main(String[] args) {
    Rock[] rocks = new Rock[10];
    for (int i=0; i<rocks.length; i++) {
      rocks[i] = new Rock(Math.random()*10);
    }
    double total = 0;
    for (int i=0; i<rocks.length; i++) {
      total += rocks[i].getWeight();
    }
    System.out.println("totalWeight=" + total);
  }
}