Prepare a new int[] variable and inititialize it

Assignment Help C/C++ Programming
Reference no: EM13707287

Program: public static int[] random(int size, int min, int max)

This method takes three integers and then creates and returns a new int array with size given by the size argument and filled with random values in the range [min, max].

Prepare a new int[] variable and inititialize it to be a new int array with the given size to create random values use the random class import javautil.random inside the method create a new instance with: Random rand = new Random();

The loop through the indexes of the array you created and fill them with a random number between min and max to generate a random number between min and max use random.nextINt(max-min+1) + min

Return now to the filled in array after the loop, to return an array, just return the name of the array, like for all the other variables.

You have to create and return a new int array with size. I am stuck on how to put the dashes in correctly.

Reference no: EM13707287

Questions Cloud

Program that will call a function called writedatatofile : Write a program that will call a function called writeDataToFile to prompt a user for their first name, last name and zip code, and print this information to a file called "UserData.txt".
Find the sum and difference for numbers : Write a program that prompts the user for two numbers, finds the sum and difference for those numbers and displays a descriptive label for each computation by calling two different functions. Use Function Prototypes.
What does the execute bit mean for a directory : What does the 'execute' bit mean for a directory? Show how the execute bit works for referencing files within directories. Does the execute bit need to be set for ANY directory on the path to a file you wish to reference?
Representing an investment value and interest rate : Write a Java test program, all your code should be in the main method that asks the user for two numbers representing an investment value and interest rate.
Prepare a new int[] variable and inititialize it : Prepare a new int[] variable and inititialize it to be a new int array with the given size to create random values use the random class import javautil.random inside the method create a new instance with: Random rand = new Random();
What is a data model and what is it purpose : What is a data model and what is it purpose and what is a prototype and what is its purpose - What is a use case, and what is its purpose?
Can you find the element of an array : We would like to determine whether a given array A has a majority element, and if so, find the element.
Prepare a program that takes the data from triangle : Prepare a program that takes the data from triangle.txt (supplied in this folder) and outputs a message indicating whether the triangle is a right triangle. The text file has data for three triangles.
Explain exothermic reaction that is nonspontaneous : Question- Which of the following is consistent with an exothermic reaction that is nonspontaneous at high temperatures?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Code should include a loop that displays income

This code should include a loop that displays income generated from ticket sales for each night. Shows are performed on Thursday, Friday and Saturday nights.

  Write a c program that will calculate the gross pay of a

write a c program that will calculate the gross pay of a set of employees.for each employee the program should prompt

  Write a c program that will calculate the gross pay of a

write a c program that will calculate the gross pay of a set of employees.for each employee the program should prompt

  To overload a member function of the base class

To overload a member function of the base class A: the name of the function and the formal parameter list of the corresponding function in the derived class must be the same. B: the name of the function must be different

  The counter each time it''s clicked

Write a simple script that contains a button and a counter in a div. The button's event handler should increment the counter each time it's clicked.

  Design a class named employeerecord

Design a class named EmployeeRecord that holds an employee's ID number, name, and payrate. Include mutator methods to set the values for each data field and output the values for each data field. Create the class diagram and write the code that

  Create your own while-end repetition structure

Create your own While-End repetition structure. You decide the theme. You should provide both the pseudocode and the flowchart of your example. Be sure to provide an overview of what your repetition structure is doing. Provide a walk-through of yo..

  Write a scanf statement to read in one number (int

1) Write a scanf statement to read in one number (int), and another statement to print out that number.

  Lab9 c lab 9 c i request this twice but no answer on this

lab 9 c ltbrgti request this twice but no answer on this please could you check this for

  Prepare program to check the syntax of the english language

Determine the form of the output dependent on the coefficients being input. Print and evaluate with peers in class."

  Write a program to determine how long ball moves

Using the v2 form of drag, write a program to determine how long (sec.) and how far (m) a 150 gram ball whose radius is 3.5cm would fall before it reached 75% of its terminal velocity.

  Requires the number of bits for the exponent

Write a program that requires the number of bits for the exponent and significant of a Floating Point representation; then requires two decimal real numbers and an operation either sum

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd