public class HTML {
private String titel, source, url;
private static String ursprungspfad;
private static int laufendeNummer = 0;
HTML(String t, String s, String u){
this.titel = t;
this.source = s;
this.url = u;
}
public void setSource(String _source){
this.source = _source;
}
public void setTitel(String _titel){
this.titel = _titel;
}
/**
* Genetiert die html Seite und gibt diese wieder
*
* @return
* die generierte html Seite
*/
public String generate(){
String text = this.titel + "\n" + this.source + "\n" + this.url;
return text;
}
public static void main(String args[]){
HTML_plus h = new HTML_plus("Titel is da", "Meine URL ist schön",
"Sourcecode meldet sich zum Dienst", "Ich bin der Author und du nicht!!",
"Heute ist Donnerstag");
System.out.println(h.generate());
}
/**
* Setzt den Ursprungspfad welches bei allen Objekten gleich ist. (Static)
*
* @param _ursprungspfad
*/
public void setUrsprungspfad(String _ursprungspfad){
this.ursprungspfad = _ursprungspfad;
}
/**
* Erzeugt und setzt die URL
* Aufgabe 4 b)
*
*/
private void generateUrl(){
this.url = this.ursprungspfad + this.laufendeNummer++;
}
}
public class HTML_plus extends HTML{
private String author;
private String erstelldatum;
HTML_plus(String _titel, String _url, String _source, String _author, String _date){
super(_titel, _url, _source);
this.author = _author;
this.erstelldatum = _date;
}
public String generate(){
return super.generate() + "\n" + this.author + "\n" + this.erstelldatum;
}
}