H8 Studieprogramma Flashcards

1
Q

isGeslaagd() (Studieprogramma): Determines if a student has passed all courses in their program. Write the Java code for this method.

A

public boolean isGeslaagd() {
for (Vak vak : getStudieprogramma()) {
if (!vak.isGeslaagd()) {
return false;
}
}
return true;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

getRapport() (Studieprogramma): Generates a formatted report of a student’s results. Write the Java code for this method, including their name, overall pass/fail status, and course details, matching the provided examples.
Toont studentgegevens, zegt of de student geslaagd is of niet, en geeft een overzicht van alle vakken.

A

public String getRapport() {
String afdruk = student.getDetail();
if (isGeslaagd()) {
afdruk += “ GESLAAGD\n”;
} else {
afdruk += “ NIET GESLAAGD\n”;
}
for (Vak vak : getStudieprogramma()) {
afdruk += vak.getDetail() + “\n”;

    }
    return afdruk;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

addVak() (Studieprogramma): Adds a Vak object to the student’s study program. “Als studieprogramma het vak met deze vakcode nog niet bevat, dan… (containskey) Write the Java code for this method, preventing duplicate courses based on vakcode.

A

public void addVak(Vak v) {
if (!this.studieprogramma.containsKey(v.getVakcode())) {
this.studieprogramma.put(v.getVakcode(), v);
}
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

removeVak() (Studieprogramma): Removes a Vak object from the student’s study program. Write the Java code for this method, using the vakcode to identify the course.

A

public void removeVak(String vakcode) {
studieprogramma.remove(vakcode);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

vindVak() (Studieprogramma): Finds and returns a Vak object from the student’s study program. Write the Java code for this method, using the vakcode to locate the course.

A

public Vak vindVak(String vakcode) {
return studieprogramma.get(vakcode);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

getStudieprogramma() (Studieprogramma): Returns a List of Vak objects representing the student’s study program. Write the Java code for this method.

A

public List<Vak> getStudieprogramma() {
List<Vak> studiepgm = new ArrayList<>();
studiepgm.addAll(studieprogramma.values());
return studiepgm;
}</Vak></Vak>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

bv
TINF1234 Programmeren 6 SP 14/20 credit behaald
Schrijf een methode getDetail() die een string teruggeeft met vakinfo: vakcode, naam, studiepunten (met ‘SP’), en indien van toepassing de score (score/MAX_SCORE). Voeg toe: ‘credit behaald’ als geslaagd, ‘niet geslaagd’ als score < slaaggrens, of ‘niet deelgenomen’ als er geen score is.

A

public String getDetail() {
String afdruk = vakcode + “ “ +
naam + “ “ +
studiepunten + “ SP “;
if (score != null) {
afdruk += score + “/” + MAX_SCORE;
}
if (isGeslaagd()) {
afdruk += “ credit behaald”;
} else if (score != null) {
afdruk += “ niet geslaagd”;
} else {
afdruk += “ niet deelgenomen”;
}
return afdruk;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

setScore controleer of Integer score tussen MIN_SCORE en MAX_SCORE ligt pas dan mag de score ingevoerd worden anders geef een waarschuwing en maak de score leeg ANDERS laat de score ingevoerd

A

public void setScore(Integer score) {
if (score != null) {
if (MIN_SCORE <= score && score <= MAX_SCORE) {
this.score = score;
} else {
System.out.println(“Waarde moet tussen “ + MIN_SCORE + “ en “ + MAX_SCORE + “ liggen. “);
this.score = null;
}
} else {
this.score = score;
}
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

schrijf methode isGeslaagd() controleer , als er iets ingevuld staat van de score moet je zeker de score teruggeven dat boven of gelijk is aan SLAAG_SCORE anders geef je onwaar terug

A

public boolean isGeslaagd() {
if (score != null) {
return score >= SLAAG_SCORE;
} else {
return false;
}
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly