import java.util.function.*;
class Student {
String name;
int marks;
Student(String name, int marks) {
this.name = name;
this.marks = marks;
}
}
class Result {
public static void main(String[] args) {
Function<Student, String> f = s -> {
int marks = s.marks;
String grade = " ";
if (marks >= 80) grade = "A [Dictinction]"; else if (marks >= 60) grade =
"B [First Division]"; else if (marks >= 50) grade =
"B [Second Division]"; else if (marks >= 35) grade =
"D [Third Division]"; else grade = "E [Fail]";
return grade;
};
Student[] s = {
new Student("Sudeep", 100),
new Student("Vijay", 65),
new Student("Rama", 55),
new Student("Chinny", 45),
new Student("Vinny", 35),
};
for (Student s1 : s) {
System.out.println("Student name : " + s1.name);
System.out.println("Student marks : " + s1.marks);
System.out.println("Student grade : " + f.apply(s1));
System.out.println("-----------------------------------");
}
}
}