I am working on a java code where it should prompt the user to input the grades of N amount of students and it should output the highest grade, My code is working well but I want to give the user ability to enter the content of the array and I want to create a data type called Student for example for the array.
public class Test3 {
static double grades[] = {85, 99.9, 78, 90, 98};
static double largest() {
int i;
double max = grades[0];
for (i = 1; i < grades.length; i++)
if (grades[i] > max)
max = grades[i];
return max;
}
public static void main(String[] args)
{
System.out.println("Highest grade is : " + largest());
}
}
Any help would be really appreciated.