Question

Create a new Java program called Flip. Write code that creates and populates an array of size 25 with random numbers between

We use bluej for our JAVA program. If you can help id greatly appreciate it.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PROGRAM

/* package to use random number */
import java.util.Random;
public class Flip
{
public static void main(String[] args)
{
int i;
       /* array of size 25 */
       int arr[]=new int[25];
       /* create object rand of class Random */
       Random rand = new Random();
       for(i=0;i<25;i++)
       {
       /* take 25 random numbers 1 to 50 */
       arr[i]=rand.nextInt((50 - 1) + 1) + 1;
       }
       /* print array */
System.out.println("\nArray is :\n ");
for(i=0;i<25;i++)
       {
System.out.print(arr[i] + " ");   
}
       /* print array in reverse order */
System.out.println("\n\nArray in reverse order is :\n ");
for(i=24;i>=0;i--)
       {
System.out.print(arr[i] + " ");   
}
System.out.println();      
}
}

SCREEN SHOT

/* package to use random number */ import java.util.Random; public class Flip I { public static void main(String[] args) int

OUTPUT

: Array is 35 23 33 39 22 1 49 4 37 8 26 6 4 37 19 21 23 27 3 31 20 8 46 20 28 Array in reverse order is : 28 20 46 8 20 31 3

Add a comment
Know the answer?
Add Answer to:
We use bluej for our JAVA program. If you can help id greatly appreciate it. Create...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • We are using blueJ for my java class, if you can help me id greatly appreciate...

    We are using blueJ for my java class, if you can help me id greatly appreciate it. Create a new Java program called Flip. Write code that creates and populates an array of size 25 with random numbers between 1-50. Print the array. Print array in reverse.

  • We use bluej for our JAVA class. If you can help me id greatly appreciate it....

    We use bluej for our JAVA class. If you can help me id greatly appreciate it. Create a new Java class called AverageWeight. Create two arrays: an array to hold 3 different names and an array to hold their weights. Use Scanner to prompt for their name and weight and store in correct array. Compute and print the average of the weights entered using printf command. Use a loop to traverse and print the elements of each array or use...

  • We are using blueJ for my java class, if you can help me id greatly appreciate...

    We are using blueJ for my java class, if you can help me id greatly appreciate it. Create a new Java project/class called ChangeUp. Create an empty int array of size 6. Create a method called populateArray that will pass an array, use random class to choose a random index and prompt the user to enter a value, store the value in the array. Create a method called printArray that prints the contents of the array using the for each...

  • We are using blueJ for my java class, if you can help me id greatly appreciate...

    We are using blueJ for my java class, if you can help me id greatly appreciate it. Create a new Java project/class called ChangeUp. Create an empty int array of size 6. Create a method called populateArray that will pass an array, use random class to choose a random index and prompt the user to enter a value, store the value in the array. Create a method called printArray that prints the contents of the array using the for each...

  • We are using blueJ for my java class, if you can help me id greatly appreciate...

    We are using blueJ for my java class, if you can help me id greatly appreciate it. Create a new Java class called AverageWeight. Create two arrays: an array to hold 3 different names and an array to hold their weights. Use Scanner to prompt for their name and weight and store in correct array. Compute and print the average of the weights entered using printf command. Use a loop to traverse and print the elements of each array or...

  • Write a java program that create a 2 dimensional array of type double of size 10...

    Write a java program that create a 2 dimensional array of type double of size 10 by 10. Fill the array with random numbers using a random number generator. Print the array contents. Write a java program that creates a file called data.txt that uses the PrintWriter class. Write the numbers 1 to 42 into the file. Close the file. Attach both files. Thank you in advance

  • Write a program in either C++ or Java meeting these requirements Description: In this program, we...

    Write a program in either C++ or Java meeting these requirements Description: In this program, we assume that our data comes in dynamically. We need to maintain our data in a heap, after every insertion and deletion. We also need to handle the underlying array dynamically. whenever we detect an overflow in our array, we will create a new array with size doubling the previous size. Requirements: 1. (Dynamic Data) when we generate the data, we simulate dynamic data. We...

  • JAVA HELP: Directions Write a program that will create an array of random numbers and output...

    JAVA HELP: Directions Write a program that will create an array of random numbers and output the values. Then output the values in the array backwards. Here is my code, I am having a problem with the second method. import java.util.Scanner; import java.util.Random; public class ArrayBackwards { public static void main(String[] args) { genrate(); print(); } public static void generate() { Scanner scanner = new Scanner(System.in);    System.out.println("Seed:"); int seed = scanner.nextInt();    System.out.println("Length"); int length = scanner.nextInt(); Random random...

  • Write a Java program in Eclipse. . Write a Java program that: 1. Creates an array...

    Write a Java program in Eclipse. . Write a Java program that: 1. Creates an array of 100 integers. Initialize the array to have all zeros. 2. Puts even numbers starting from 6 (excluding multiples of 12) into the first 50 slots of the array above. So numbers 6,8,10,14,16,18,20,22,26, etc. go into the first 50 positions in the array. Print the array. 3. Puts random numbers between 45 and 55 into the second 50 slots of the array above (second...

  • Write a Java program that has a method called arrayAverage that accepts an arrary of numbers...

    Write a Java program that has a method called arrayAverage that accepts an arrary of numbers as an argument and returns the average of the numbers in that array. Create an array to test the code with and call the method from main to print the average to the screen. The array size will be from a user's input (use Scanner). - array size = int - avergage, temperature = double - only method is arrayAverage Output:

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT