nly for-loops, if statements, and arrays Write a program in java that uses that creates a 30-element array of random integers to represent Fahrenheit temperatures, ensuring that all temperatures range from 10 to 75, inclusive. Then execute a custom method with the array as its only argument. The method should begin by using a loop to print the array in 6 rows and 5 columns, with all columns being seven characters wide. Duplicates are okay. This same loop should determine how many temperatures in the array are below freezing. Use this figure to declare an new array of integers named freezing. Process the array again, but this time with a foreach loop, and add the freezing temperatures to the freezing array. Return this new array back to main. Report the number of temperatures that were below freezing, sort them, and print them all on one line separated by spaces.
only for-loops, if statements, and arrays
Write a program in java that uses that creates a 30-element array of random integers to represent Fahrenheit temperatures, ensuring that all temperatures range from 10 to 75, inclusive. Then execute a custom method with the array as its only argument. The method should begin by using a loop to print the array in 6 rows and 5 columns, with all columns being seven characters wide. Duplicates are okay. This same loop should determine how many temperatures in the array are below freezing. Use this figure to declare an new array of integers named freezing. Process the array again, but this time with a foreach loop, and add the freezing temperatures to the freezing array. Return this new array back to main. Report the number of temperatures that were below freezing, sort them, and print them all on one line separated by spaces.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images