import java.util.*;import java.io.*;import java.text.*;public class PatientRecord{ public static void main(String[] args) { //declarations String name, id, address; int height; double weight; Date bd, initVisit, lastVisit; List<Patient> patients = new ArrayList<>(); Patient patient; System.out.printf("::\tMenu\t\t\t::\n::\n"); System.out.printf("::1 - Display List\n::2 - Add a New Patient\n"); System.out.printf("::3 - Show Information For a Patient\n::4 - Delete a Patient\n"); System.out.printf("::5 - Show Average Patient Age\n::6 - Show Information for the Youngest Patient\n"); System.out.printf("::7 - Show Notification List\n"); System.out.printf("::::::\n"); System.out.printf("Choice: "); Scanner inChoice = new Scanner(System.in); int choice; choice = inChoice.nextInt(); //read current records //store records into memory in an ArrayIndexedList String currName, currID, currAddress; int currHeight; double currWeight; Date currBD, currInitVisit, currLastVisit; /* Read the current database file. Store all the data in memory for * fast access. */ System.out.printf("Where are the current patients stored?: "); Scanner inFile = new Scanner(System.in); String dbFile = inFile.nextLine(); try { FileInputStream fstream = new FileInputStream(dbFile); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String patientString; int number = 0;// patient number while ((patientString = br.readLine()) != null) { //Here, each line is tokenized, then the separated data is stored. String[] line = patientString.split(","); currName = line[0]; currID = line[1]; currAddress = line[2]; currHeight = Integer.parseInt(line[3]); currWeight = Double.parseDouble(line[4]); DateFormat formatter; formatter = new SimpleDateFormat("dd-MM-yyyy"); currBD = (Date)formatter.parse(line[5]); currInitVisit = (Date)formatter.parse(line[6]); currLastVisit = (Date)formatter.parse(line[7]); patient = new Patient(currName, currID, currAddress, currHeight, currWeight, currBD, currInitVisit, currLastVisit); patients.add(number, patient); number++; } in.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } switch(choice) { //Display List case 1: //for(int i = 0; i <= patientList.size()-1;i++) System.out.println(patients); break; //Add Patient case 2: break; //Show Patient Info case 3: break; //Delete Patient case 4: break; //Show Average Patient Age case 5: break; //Show Info of Youngest case 6: break; //Show notifications list case 7: break; } }}