Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package inherit;
- import java.util.ArrayList;
- public class Student extends Person{
- private int gpa;
- private ArrayList<String> schedule;
- //default constructor calls
- public Student(){
- //here is where Person constructor is called
- super();
- gpa=4;
- schedule=new ArrayList<>();
- }
- public Student(String name, int age, String email,
- int gpa, ArrayList<String>schedule){
- super(name, age, email);
- this.gpa=gpa;
- this.schedule=schedule;
- }
- //explicit constructor calls.
- public int getGpa() {
- return gpa;
- }
- public void setGpa(int gpa) {
- this.gpa = gpa;
- }
- public ArrayList<String> getSchedule() {
- return schedule;
- }
- public void setSchedule(ArrayList<String> schedule) {
- this.schedule = schedule;
- }
- @Override
- public String toString() {
- return super.toString()+" Student{" +
- "gpa=" + gpa +
- ", schedule=" + schedule +
- '}';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement