Java - Array as Return Value

preview_player
Показать описание
Java - Array as Return Value
Lecture By: Mr. Tushar Kale, Tutorials Point India Private Limited
Рекомендации по теме
Комментарии
Автор

Hey Mr Kale
I've been struggling with this code for a while

import java.util.Random;
public class LetsWork
{
public static void main(String[] args)
{
Random randomizer = new Random();
int [] marks = new int[10];
String[] students = {"John Smith", "Alicia Bianca", "James Watterson", "Andre Adkins", "Susan Walker", "Leo Jackson", "Paul Darwin", "Lorenzo Grey", "Diana Curtis", "Joe Hart"};

for(int i=0;i<marks.length;i++)
{
marks[i] = randomizer.nextInt(100);
}
boolean check=true;
check = verify(marks);
for(int s=0;s<students.length;s++)
{
if(check=false)
{
+ " You passed!!!! You Got " + marks[s]);
}
else
if(check=true)
{
+ " Unfortunately you didn't meet the pass requirements You Got " + marks[s] );
}
}
}

public static boolean verify(int[] mark)
{

for(int i=0;i<mark.length;i++)
{
if(mark[i]<50)
{
return false;
}
}
return true;
}
}



This code must randomly give this students marks and if student's marks is 50 and above the student else the student failed...
The code doesn't return the required boolean

khethiwecreatives