class person {
String firstname;
String lastname;
String street;
String number;
String city;
String postalcode;
person (String frstnam, String lstnam, String strt, String nmbr, String cty, String pstlcd) {
firstname = frstnam;
lastname = lstnam;
street = strt;
number = nmbr;
city = cty;
postalcode = pstlcd;
}
void print () {
System.out.println ("Firstname: " + firstname);
System.out.println ("Lastname: " + lastname);
System.out.println ("Street/Street number: " + street + " " + number);
System.out.println ("City: " + city);
System.out.println ("Postalcode: " + postalcode);
}
}
class student extends person {
String matricularnumber;
String subject;
String dateofimmatriculation;
String dateofcompletion;
student (String frstnam, String lstnam, String strt, String nmbr, String cty, String pstlcd, String mtrclnmbr, String sbjct, String dtimmatrcl, String dtcmpltn) {
super (frstnam, lstnam, strt, nmbr, cty, pstlcd);
matricularnumber = mtrclnmbr;
subject = sbjct;
dateofimmatriculation = dtimmatrcl;
dateofcompletion = dtcmpltn;
}
void print () {
super.print();
System.out.println ("Matricular number: " + matricularnumber);
System.out.println ("Subject: " + subject);
System.out.println ("Date of immatriculation: " + dateofimmatriculation);
System.out.println ("Date of completion: " + dateofcompletion);
}
}
public class personsprogram {
public static void main (String [] argv) {
person a;
student b;
a = new person ("David", "Vajda", "Rappenberghalde", "21", "Tuebingen", "72070");
a.print();
b = new student ("David", "Vajda", "Rappenberghalde", "21", "Tuebingen", "72070", "7828020", "informatic", "2009", "2025");
b.print();
}
}