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

  Program that will calculate the heat transfer of a substance

write a program that will calculate the heat transfer of a substance (water) given three different shapes. The user has to be able to input the type of shape, so that the computer can calculate area, and plug it back in to the equation for heat trans..

  Program that stores a series of numbers in a binary tree

Write a program that stores a series of numbers in a binary tree

  Write a class volumeofbox that calculate the volume

write a class VolumeOfBox that calculate the volume by this formula : length * breadth *

  Write main function to compute stress-strain in steel rod

Write a main function and the following functions to compute the stress and strain in a steel rod of diameter D (inches) and length L (inches) subject to the compression loads.

  Write definitions of the functions to overload the operators

Write the definitions of the functions to overload the operators defined in parts a to c and write  a  test  program  that  tests  various  operations  on  the class rectangleType.

  Build a traffic light system - microcontroller system

Build the whole system with 3 RAG units and three puffin crossing units and build a team to work on this mini-project, be careful in selecting your team member.

  The second argument to the function is the string

The function fnUserBinaryInputX has 2 input arguments, each is a string. The first string is the "prompt" string displayed to the user when asked to enter a string. The second argument to the function is the string to compare the user entered stri..

  Create a program, using at least one for loop

Create a program, using at least one For loop, that displays the Sales Amounts made in each of 4 regions (North, South, East, and West) during a three month period.

  To deal with deadlocks we can either use prevention or

to deal with deadlocks we can either use prevention or avoidance or detection followed by recovery. but which is a

  Battleship redux

Game Battleship is back and better than ever. Instead of hacking everything together in C, you will instead leverage C++ and all of your newly gained object oriented programming knowledge to construct a much cleaner end product.

  Design and write a c++11/fltk game program

The project is to design and write a C++11/FLTK game program with a graphical user interface. The game is based on "pancake sorting," which actually has some mathematical significance.

  Linked list program

This lab, along with your TA, will help you navigate through designing, implementing, and testing a dynamic linked list.  Linked lists may be used to implement many real world applications. Recall, linked lists are data structures, which represent co..

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