import java.util.*;
import java.lang.*;
public class Utility
{
private Scanner scanner = new Scanner(System.in);
public String readUserInput(String inputMsg)
{
System.out.print(inputMsg);
if (scanner.hasNextLine())
{
return scanner.nextLine();
}
return "";
}
public OptionalInt parseInt(String input)
{
try
{
int result = Integer.parseInt(input);
return OptionalInt.of(result);
}
catch (Exception ex)
{
return OptionalInt.empty();
}
}
public Optional<Student> findStudent(Student[] students, int studentNumber)
{
for (int i = 0; i < students.length; i++)
{
Student currentStudent = students[i];
if (currentStudent.hasStudentNumber(studentNumber))
{
return Optional.of(currentStudent);
}
}
Optional<Student> empty = Optional.empty();
return empty;
}
public void printStudents(Student[] students)
{
System.out.println("The group now contains:");
for(Student student : students)
{
System.out.println(student.toString());
}
System.out.println("");
}
}