0% found this document useful (0 votes)
28 views2 pages

Student

The document defines a Student class that extends a Person class. The Student class has fields for program and year level. The Person class has fields for name and contact number.

Uploaded by

Koro Sensei
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Student

The document defines a Student class that extends a Person class. The Student class has fields for program and year level. The Person class has fields for name and contact number.

Uploaded by

Koro Sensei
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

public class Student extends Person{

private String program;


private int yearLevel;

public Student() {}
public Student(String n, String c, String p, int y) {
super(n, c);
this.program = p;
this.yearLevel = y;
}

public void setProgram(String p) {


this.program = p;
}

public class Person {


private String name;
private String contactNum;

//constructor with no arguments


public Person () {}

//constuctor with arguments


public Person (String n, String c) {
this.name = n;
this.contactNum = c;
}

public void setName(String n) {


this.name = n;
}

public String getName() {


return name;
}

public void setContactNum(String c) {


this.contactNum = c;
}

public String getContactNum() {


return contactNum;
}
}

public class Person {


private String name;
private String contactNum;

//constructor with no arguments


public Person () {}

//constuctor with arguments


public Person (String n, String c) {
this.name = n;
this.contactNum = c;
}

public void setName(String n) {


this.name = n;
}

public String getName() {


return name;
}

public void setContactNum(String c) {


this.contactNum = c;
}

public String getContactNum() {


return contactNum;
}
}

public String getProgram() {


return program;
}

public void setYearLevel(int y) {


this.yearLevel = y;
}

public int getYearLevel() {


return yearLevel;
}
}

You might also like