Question

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

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

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

Source Code:


class blueJ
{
   public static void main(String[] args) {
       int[] arr=new int[25];
       int max=50,min=1,i=0;
       for(i=0;i<25;i++)
       {
           arr[i]=(int)(Math.random()*(max-min+1)+min);
       }
       System.out.println("Array Elements:");
       for(i=0;i<25;i++)
       {
           System.out.print(arr[i]+" ");
       }
       System.out.println();
       System.out.println("Array Elements in Reverse order:");
       for(i=24;i>=0;i--)
       {
           System.out.print(arr[i]+" ");
       }
       System.out.println();
   }
}

2 class blue] 3 { public static void main(String[] args) { int[] arr=new int [25]; int max=50,min=1,i=0; for(i=0;i<25;i++) {

Sample input and output:

(base) rgukti@rgukt-TravelMate-P243-M:-/Desktop$ java blue] Array Elements: 12 38 25 29 12 44 12 10 47 6 33 17 24 46 11 4 36

Add a comment
Know the answer?
Add Answer to:
We are using blueJ for my java class, if you can help me id greatly appreciate...
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 use bluej for our JAVA program. If you can help id greatly appreciate it. Create...

    We use bluej for our JAVA program. If you can help 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 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...

  • 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...

  • 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

  • Please help me with this Java problem. Would greatly appreciate comments in the code as well:...

    Please help me with this Java problem. Would greatly appreciate comments in the code as well: Define a class called Counter whose internal "count" variable is a basic integer counter. This class track that count from its instantiation in the constructor (can be set to any positive integer, or 0). The count should never be allowed to be negative. Include methods that will set the counter to 0, increase the count by 1, and decrease the count by 1. Include...

  • Using Java: Create an array with the size of 10 and assign student details (Name, ID,...

    Using Java: Create an array with the size of 10 and assign student details (Name, ID, age and TotalMarks) to the array. Perform the Heap Sort to sort the students in ascending order based on their total marks. Steps: • Create the student list (use Random class in java to generate the age (15- 25) and total (0-100)) • Print the Student List in a table format • Perform Heap sort based on the total marks of the students •...

  • 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:

  • Java using data structures The objective is to create your own Hash Table class to hold...

    Java using data structures The objective is to create your own Hash Table class to hold a list of employees and their ID numbers. I've provided the TableEntry class which will be each data object in the hash table. The list of employees will be provided as a .txt file and must be read with the code. please create a .txt file called Employees.txt with the info provided so that the java code can read it in. Employees.txt: (No WhiteSpace...

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