The question is: get a score of 10 peoples; then you need to ask each one with a score higher than 80 if he would want to continue studying 'y' for yes and 'n' for no. Next you need to get their location in the array so if person number 5 array[5]=90 and answers 'y' it will make a new array with newarray[1]=[5(his location)]
My question is how to define the newarray without knowing its length(how many 'y' there would be). EDIT:
import java.util.Scanner;
public class p44_52 {
static Scanner reader = new Scanner(System.in);
static void input(int []a)
{
for(int i=0; i<a.length;i++){
System.out.println("Write an score of a student");
a[i]= reader.nextInt();
}
}
static void output(int []b)
{
for (int i =0; i<b.length;i++)
{
System.out.println("serial number of who choose to continue and score above 80 "+ b[i]);
}
}
public static void main(String[]args){
char c = 'g';
int count =0;
int []score = new int[10];
kelet(score);
for(int i=0; i<score.length;i++)
{
if(score[i]>80)
{
System.out.println("Studnet number "+i+ " Do you want to continue?");
c = reader.next().charAt(0);
if(c == 'y'){
//Here i want to make the new array(length isn't known) for their locationnumbers
}
}
}
}
}