43 lines
1.1 KiB
Java
43 lines
1.1 KiB
Java
package de.joethei.hs.java2.praktikum.praktikum3;
|
|
|
|
import java.util.List;
|
|
|
|
public class Vorlesung {
|
|
private String studiengruppe;
|
|
private String title;
|
|
private String dozent;
|
|
private int teilnehmerzahl;
|
|
|
|
public Vorlesung(List<String> list) throws TextFileFormatException {
|
|
if(list.size() != 4) throw new TextFileFormatException("invalid number of Strings in list");
|
|
this.studiengruppe = list.get(0);
|
|
this.title = list.get(1);
|
|
this.dozent = list.get(2);
|
|
try {
|
|
this.teilnehmerzahl = Integer.parseInt(list.get(3));
|
|
}catch (NumberFormatException ex) {
|
|
throw new TextFileFormatException("Input is no number");
|
|
}
|
|
}
|
|
|
|
String getStudiengruppe() {
|
|
return studiengruppe;
|
|
}
|
|
|
|
String getTitle() {
|
|
return title;
|
|
}
|
|
|
|
String getDozent() {
|
|
return dozent;
|
|
}
|
|
|
|
int getTeilnehmerzahl() {
|
|
return teilnehmerzahl;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return studiengruppe + ":" + title + ":" + dozent + ":" + teilnehmerzahl;
|
|
}
|
|
} |