Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. public class Student extends Person {
  2.  
  3. //data fields or properties
  4. private String studentID;
  5.  
  6. //No-arg constructor
  7. Student(){
  8. setFirstName("NA");
  9. setLastName("NA");
  10. studentID = "NA";
  11. }
  12.  
  13. //Constructor
  14. Student(String fName, String lName, String sID){
  15. setFirstName(fName);
  16. setLastName(lName);
  17. studentID = sID;
  18. }
  19.  
  20. //Setters
  21. public void setStudentID (String sID){
  22. studentID = sID;
  23. }
  24.  
  25. //Getters
  26. public String getStudentID(){
  27. return studentID;
  28. }
  29.  
  30. //This method overrides the same method in Person.java
  31. public String getFullNamePlusID(){
  32. return (super.getFullName() + ": " + studentID);
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement