My current issue is couldn't get my program to display the user's desired student info when entering names (both given name and surname) out on to console.
to read data from text file and store it:
BufferedReader file = new BufferedReader(new FileReader("student.txt"));
String line = "";
List<Student> student = new ArrayList<>(10);
while((line = file.readLine()) != null)
{
part = line.split(", ");
type = part[0];
title = part[1];
firstName = part[2];
lastName = part[3];
studentNumber = Long.parseLong(part[4]);
birthDay = Integer.parseInt(part[5]);
birthMonth = Integer.parseInt(part[6]);
birthYear = Integer.parseInt(part[7]);
if(type.equals("Research"))
{
//Research Student
int proposal = Integer.parseInt(part[8]);
int oral = Integer.parseInt(part[9]);
int thesis = Integer.parseInt(part[10]);
student.add(new ResearchStudent(title, firstName, lastName, studentNumber, birthDay, birthMonth, birthYear, proposal, oral, thesis));
}
my source code for prompting user inputs and displaying info:
if(select == 6)
{
switch(selectStudent)
{
case 1:
System.out.println("Enter name of student with both surname and given name: ");
String name = keyboard.nextLine().trim();
String fullName = firstName +lastName;
//
BufferedReader case6 = new BufferedReader(new FileReader("student.txt"));
String nextline = " ";
while((nextline = case6.readLine()) != null)
{
if(name.equalsIgnoreCase(fullName))
{
((ResearchStudent) student).display();
}
}