/** * This program generates and then adds up 10 random doubles between 1 and 25 incl. */ class Main {//M public static void main(String[] args) { //main double sum = 0.0; double [] weights = new double[10]; for(int w=0; w< weights.length; w++) { //weights weights[w] = getRandom(25) + 1; //weights[w] = 1; sum = sum + weights[w]; } //weights System.out.println("sum = " + sum); } //main /** Provides a random int between 0 and max, not including max @return 0 <= num < max */ public static int getRandom(int max) { //getRandom return (int)(Math.random() * max); } //getRandom } //M