Question: Java: Write a program that creates a 30-element array of random integers to represent Fahrenheit temperatures, ensuring that all temperatures range from 10 to 75
Java: Write a program 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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
