Advertisement
cgorrillaha

Untitled

Mar 15th, 2022
802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. package inherit;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. public class Student extends Person{
  6.     private int gpa;
  7.     private ArrayList<String> schedule;
  8.  
  9.     //default constructor calls
  10.  
  11.     //explicit constructor calls.
  12.  
  13.     public int getGpa() {
  14.         return gpa;
  15.     }
  16.  
  17.     public void setGpa(int gpa) {
  18.         this.gpa = gpa;
  19.     }
  20.  
  21.     public ArrayList<String> getSchedule() {
  22.         return schedule;
  23.     }
  24.  
  25.     public void setSchedule(ArrayList<String> schedule) {
  26.         this.schedule = schedule;
  27.     }
  28.  
  29.     @Override
  30.     public String toString() {
  31.         return "Student{" +
  32.                 "gpa=" + gpa +
  33.                 ", schedule=" + schedule +
  34.                 '}';
  35.     }
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement