Esempio n. 1
0
 public void updateRecord(Exercise updatedExercise) {
     for (Exercise member : myList) {
         if (member.getId() == updatedExercise.getId()) {
             member.setMemberNumber(updatedExercise.getMemberNumber());
             member.setexcerciseType(updatedExercise.getexcerciseType());
             member.setDate(updatedExercise.getDate());
             member.setTime(updatedExercise.getTime());
             break;
         }
     }
     writeList();
 }
Esempio n. 2
0
 protected void writeList() {
     Path path = Paths.get(fileName);
     try (BufferedWriter writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
         for (Exercise member : myList) {
             writer.write(String.format("%d,%s,%s,%s,%.2f\n",
                     member.getId(),
                     member.getMemberNumber(),
                     member.getexcerciseType(),
                     member.getDate(),
                     member.getTime(),
                     member.getComments());
         }
     } catch (IOException ioe) {
         System.out.println("Write file error with " + ioe.getMessage());
     }
 }