有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

当分数的平行值为某个数字或更高时,java将传递的元素设置为true?

方法(publicstaticvoidprocesspass)(布尔[]传递,双[]分数,int 长度)应接受通过、分数和长度作为参数,并且当平行值为 分数为60分或60分以上

我刚开始编程II,一切都变得非常复杂。我有实验室的第一部分(我没有提到),但我不知道我在最后一种方法中做了什么

这个网站总是很有帮助,我很感激

public static void main(String[] args) throws IOException {
    boolean[] isPassing = new boolean[100];
    double[] scores = new double[100]; 

    getData(scores);
    
}

public static int getData(double scores[]) throws FileNotFoundException {
    
    File fileIn = new File("lab1data.txt");
    
    int length = 0;
            
    Scanner infile = new Scanner(fileIn);
    
    while(infile.hasNext()) {
        
    scores[length] = infile.nextDouble();
    
    length +=1;
    }
    
    for(int i = 0; i < length; i++) {
        System.out.println(scores[i] + "\n");
    }
    
    System.out.println("Length: " + length);
    
    infile.close();
    
    return length;  
    
    
    
}

//this is what I am struggling with

public static void processPass(boolean[] passing, double[] scores, int length) {
    if(length <= 60) {
        passing[length] = true;
    }

    System.out.println(passing[length]);
    
}

}


共 (0) 个答案