Guest_imported
New member
- Jan 1, 1970
- 0
- 0
- 0
Im stumped on this homework assignment. I could really use some help. Heres the problem;
Below is an almost completely working program. The body of the isFound method has been removed, and your job is to complete the program, compile and run it, and hand-in a print out of your completed working source code. Keep in mind that this program must be writted in a source file named prog1.java since the class name is prog1.
//Program Starts here
import java.util.*;
public class prog1
{
//Integer array
static int[] data = new int[50];
public static void main(String[] args)
{
// fill array with random numbers
Random r = new Random();
for(int i = 0; i < data.length; i++)
{
data = r.nextInt();
}
// print out 10 true/false value depending if the random number is found
for(int i = 0; i < 10; i++)
{
System.out.println(isFound(r.nextInt()));
}
}
//Method named isFound that takes an integer as a parameter
//and returns true if that interger is found in the integer
//array data, and false otherwise.
static boolean isFound(int val)
{
}
}
//Program Ends here
Below is an almost completely working program. The body of the isFound method has been removed, and your job is to complete the program, compile and run it, and hand-in a print out of your completed working source code. Keep in mind that this program must be writted in a source file named prog1.java since the class name is prog1.
//Program Starts here
import java.util.*;
public class prog1
{
//Integer array
static int[] data = new int[50];
public static void main(String[] args)
{
// fill array with random numbers
Random r = new Random();
for(int i = 0; i < data.length; i++)
{
data = r.nextInt();
}
// print out 10 true/false value depending if the random number is found
for(int i = 0; i < 10; i++)
{
System.out.println(isFound(r.nextInt()));
}
}
//Method named isFound that takes an integer as a parameter
//and returns true if that interger is found in the integer
//array data, and false otherwise.
static boolean isFound(int val)
{
}
}
//Program Ends here