Home / Expert Answers / Computer Science / help-me-to-solve-localdate-cannot-be-resolve-i-39-ve-already-tried-to-add-import-java-time-localdate-pa561

(Solved): help me to solve localdate cannot be resolve. I've already tried to add import java.time.LocalDate; ...



help me to solve localdate cannot be resolve. I've already tried to add import java.time.LocalDate; but when I do that for the place add comment //localdate cannot be resolve this error message will change to The constructor Student(String, String, String, String, String, String, String, String, String, LocalDate, double) is undefined (Java). It's like a loop so I am getting stuck. please help me package model; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * InputHandler is responsible for parsing data from files into the system. */ public class InputHandler { /** * Parses student data from a file and returns a list of students. * @param filename The path to the file containing the student data. * @return A list of students parsed from the file. * @throws IOException If there is an error reading the file. */ public List parseStudentsFromFile(String filename) throws IOException { List students = new ArrayList(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(filename)); String line; while ((line = reader.readLine()) != null) { String[] data = line.split(","); // Inside the parseStudentsFromFile method in InputHandler.java Student student = new Student(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], LocalDate.parse(data[9]), Double.parseDouble(data[10])); //LocalDate cannot be resolved (Java) students.add(student); } } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { System.err.println("Error closing the reader: " + e.getMessage()); } } } return students; } /** * Parses faculty data from a file and returns a list of faculty members. * @param filename The path to the file containing the faculty data. * @return A list of faculty members parsed from the file. * @throws IOException If there is an error reading the file. */ public List parseFacultyFromFile(String filename) throws IOException { List faculty = new ArrayList(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(filename)); String line; while ((line = reader.readLine()) != null) { String[] data = line.split(","); Faculty facultyMember = new Faculty(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], LocalDate.parse(data[9]), Boolean.parseBoolean(data[10])); faculty.add(facultyMember); } } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { System.err.println("Error closing the reader: " + e.getMessage()); } } } return faculty; } /** * Parses course data from a file and returns a list of courses. * @param filename The path to the file containing the course data. * @return A list of courses parsed from the file. * @throws IOException If there is an error reading the file. */ public List parseCoursesFromFile(String filename) throws IOException { List courses = new ArrayList(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(filename)); String line; while ((line = reader.readLine()) != null) { String[] data = line.split(","); Course course = new Course(data[0], data[1], data[2], Integer.parseInt(data[3]), Integer.parseInt(data[4])); courses.add(course); } } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { System.err.println("Error closing the reader: " + e.getMessage()); } } } return courses; } }



We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe