public String submitAnswer(
      String username, String assignmentName, ArrayList<String> codeStrings, int cyclomaticNumber) {

    String ret = "";
    String answerName = assignmentName + "_" + username;

    Student stu = studentRepository.findByUsername(username);
    Assignment assign = assignmentRepository.findByName(assignmentName);
    Answer ans = null;

    EndResult<Answer> anss = answerRepository.findAll();
    for (Answer an : anss) {
      if (answerName.equals(an.getName())) {
        ans = an;
        break;
      }
    }

    if (stu == null) {
      ret = "Student doesn't exist!";
      return ret;
    }

    if (assign == null) {
      ret = "Assignment doesn't exist!";
      return ret;
    }

    if (ans == null) {

      ans = new Answer(answerName, stu, assign);
      ans.setCodeStrings(codeStrings);
      ans.setCyclomaticNumber(cyclomaticNumber);

      stu.addAnswer(ans);
      assign.addAnswer(ans);

      answerRepository.save(ans);
      studentRepository.save(stu);
      assignmentRepository.save(assign);

    } else {
      ret = "Resubmission is not allowed.";
    }

    return ret;
  }
  public void printAnswers(String username) {

    Student stu = studentRepository.findByUsername(username);

    for (Answer ans : stu.getAnswers()) {
      System.out.println("Assignment Name: " + ans.getAssignment().getName());
      System.out.println("Code String");
      for (int i = 0; i < ans.getCodeStrings().size(); i++) {
        System.out.println(ans.getCodeStrings().get(i));
      }
      System.out.println("Code String Points");
      for (int i = 0; i < ans.getCodeStringsPoints().size(); i++) {
        System.out.println(ans.getCodeStringsPoints().get(i));
      }
      System.out.println(
          "Cyclomatic Number: "
              + ans.getCyclomaticNumber()
              + ", Points: "
              + ans.getCyclomaticNumberPoint());
    }
  }