Esempio n. 1
0
  public static void main(String[] args) {
    StudentScores studSc = new StudentScores();
    Scanner in = new Scanner(System.in);
    boolean done = false;
    // Read the students names and scores, and add them to studSc
    do {
      Student s = new Student();

      System.out.println("Enter a student name or -1 to end: ");
      String name = in.nextLine();
      if (name.equals("-1")) done = true;
      else {
        System.out.println("Enter the student's score: ");
        int score = in.nextInt();
        in.nextLine(); // skip the end-of-line character
        /** Your code goes here */
        s.SetStudent(name, score);
      }
      studSc.add(s);
    } while (!done);
    // Find the students with highest and lowest scores and print
    // their names and scores
    /** And here */
    System.out.println("가장 높은 점수 >> " + studSc.getHighest());
    System.out.println("가장 낮은 점수 >> " + studSc.getLowest());
  }
  /**
   * Loops through all currently loaded Students and matches Anon Codes If matched then replaces
   * anon codes with Student Name
   *
   * @param assessments - ArrayList of currently loaded Assessments
   * @param students - ArrayList of all students
   */
  public void deAnnonymise(ArrayList<Assessment> assessments, ArrayList<Student> students) {
    for (Assessment a : assessments) {
      for (Result t : a.getResults()) {
        String candKey = t.getCandKey();
        // Checks if candKey is actually student number
        // If candKey is student Number, then is coursework file
        if (candKey.substring(candKey.length() - 2, candKey.length() - 1).equals("/")) {
          // Removes the end /1 or /2 after student number
          candKey = candKey.substring(0, candKey.length() - 2);
          candKey = candKey.replaceAll("#", "");

          for (Student s : students) {
            // Finds student with matching student numbers
            if (candKey.equals(s.getStudentNumber() + "")) {
              t.setCandKey(s.getStudentNumber() + "");
              s.addMarks(t.getModuleCode() + " " + t.getAssessment(), t.getMark());
            }
          }
        } else {
          // If candKey is anon code
          for (Student s : students) {
            candKey = candKey.replaceAll("#", "");
            if (candKey.equals(s.getAMC() + "")) {
              // Finds student with matching anonymous marking code replaces it with student number
              t.setCandKey(s.getStudentNumber() + "");
              t.setName(s.getName());
              s.addMarks(t.getModuleCode() + " " + t.getAssessment(), t.getMark());
            }
          }
        }
      }
    }
  }
Esempio n. 3
0
  public static void main(String[] args) {

    for (int count = 1; count > 0; count++) {
      Scanner input = new Scanner(System.in);

      Student s1 = new Student("Test", 16, 100);
      System.out.println("Enter the student's name.");
      String name = input.nextLine();
      System.out.println("Enter the student's age.");
      int age = input.nextInt();
      System.out.println("Enter the student's mark.");
      int mark = input.nextInt();

      s1.setAge(age);
      s1.setName(name);
      s1.setMark(mark);

      System.out.println(s1.getName() + " " + s1.getAge());
      System.out.println(s1.getAverage());
    }
  }