Search code examples
javauml

Converting Sequence Diagram to Java code


My teacher assigned an exercise which consists in translating (in the best possible way) a sequence diagram to Java code.

This is the sequence diagram:

enter image description here

And this is my attempt at solving this:

import java.util.ArrayList;
import java.util.List;

class Seminar {
    private int getMark() {
        return calculateMark();
    }

    private int calculateMark() {
        return 10;
    }
}

class Student {
    private List<Seminar> _seminars = new ArrayList<>();

    public List<Seminar> getSeminars() {
        return _seminars;
    }
}

class TranscriptBuilder {
    public void New(Student student) {

    }
}

But I couldn't finish TranscriptBuilder as I couldn't find anything about <<system>> and what it means. Any suggestions, please?


Solution

  • The <<system>> is a sterotype in UML :

    A stereotype defines how an existing metaclass may be extended, and enables the use of platform or domain specific terminology or notation in place of, or in addition to, the ones used for the extended metaclass.

    I think here it refers to the core system where you need to implement a method to print the Student information.

    I suggest you @Override the toString() method in Student then implement a print() method in SharedServices as indicated in your diagram.