Explore BrainMass
Share

Explore BrainMass

    Java Program which Defines Two Unconstrained Arrays Runtime

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a Java program which defines two unconstrained arrays of user defined length n, that contain n Random numbers each and which outputs the addition of pairs of elements. For example, given {1, 2, 3} and {4, 5, 6} the output would be {5, 7, 9}. Please use well commented code.

    © BrainMass Inc. brainmass.com October 9, 2019, 6:41 pm ad1c9bdddf
    https://brainmass.com/computer-science/random-number-generation/java-program-which-defines-two-unconstrained-arrays-runtime-94682

    Solution Preview

    Following is the program with commented code.
    Hope it helps
    /***************************************************/
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.util.Random;

    /**
    *
    * User: Mahmood
    * Date: Sep 9, 2006
    * Time: 10:20:56 AM
    * To change this template use File | Settings | File Templates.
    */
    public class Arrays {
    public static int n;
    public static final int LIMIT = 1000;
    public static Random generator ...

    Solution Summary

    Learn how to generate array size while the program is running.

    $2.19