Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PO 0 1 Help me fix my code please, I dont want to use any different method types just want to make what I have
PO "Help me fix my code please, I dont want to use any different method types just want to make what I have work please. Use jGrasp and its in Java.
import java.util.;
The program asks the user for three number inputsrange:x y and size of all random number sets to determine and display the array's average of the sets of random numbers.
@bugs No bugs in the program, if any.
public class LastnameFirstname
main method
public static void mainString args
Scanner input new ScannerSystemin;
int userInput ;
int userMin ;
int userMax ;
double set new doubleuserInput;
double sum new doubleuserInput;
giving user brief instructions
System.out.printlnAloha This program simply creates sets of random numbers that;"";
System.out.printlnWill ask you for min and max values then calculates the average of each set."";
System.out.printlnBefore we ask you for the min and max."";
for int i ; i userInput; i
System.out.printlnHow many numbers are in each of these sets? userInput;
userInput input.nextInt;
asking user for range of numbers to generate for each random set
System.out.printlnAccording to the amount of random numbers in each set chosen by you;"";
System.out.printlnPlease provide the following information below:"";
System.out.printlnEnter minimum value: userMin;
userMin input.nextInt;
System.out.printlnEnter maximum value: userMax;
userMax input.nextInt;
System.out.printlnOkay give me a couple seconds..."";
System.out.printlnALOHA;
System.out.printlnAverage of all sets:"";
System.out.printlnSet #: averagesum;
System.out.printlnSet #: averagesum;
System.out.printlnSet #: averagesum;
System.out.printlnSet #: averagesum;
System.out.printlnSet #: averagesum;
Generate a double array with given size, minimum, and maximum value
public static double generateNumsint userInput, int userMin, int userMax
Random random new Random;
double data new doubleuserInput;
for int i ; i userInput; i
dataiMathrandomuserMax userMin userMin;
return data;
method getting the average of each individual sets
public static double averagedouble data
double sum ;
for int i ; i userInput; i
sum datai;
return sum data.length;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started